Python Forum
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
n00b needs help
#3
thanks nilamo.

i cut it down to very basic, just trying to print the lines in file2 that match my regex.

with open("/path/to/file1", 'r') as s:
  number = '12345'

with open("/path/to/file2", 'r') as f:
  for line in f:
      if number in line:
        print line
this works, but now if i try to add a second number to number it doesn't work.  do i need an array or something for the values?
Reply


Messages In This Thread
n00b needs help - by theturd - Jun-06-2017, 07:10 PM
RE: n00b needs help - by nilamo - Jun-06-2017, 07:31 PM
RE: n00b needs help - by theturd - Jun-06-2017, 09:11 PM
RE: n00b needs help - by nilamo - Jun-06-2017, 09:24 PM
RE: n00b needs help - by snippsat - Jun-06-2017, 09:40 PM
RE: n00b needs help - by theturd - Jun-07-2017, 06:56 PM
RE: n00b needs help - by nilamo - Jun-07-2017, 07:01 PM
RE: n00b needs help - by snippsat - Jun-08-2017, 10:28 AM
RE: n00b needs help - by theturd - Jun-12-2017, 01:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  n00b question millpond 6 3,485 Jul-13-2019, 06:41 AM
Last Post: Gribouillis
  n00b help with referencing files theturd 8 5,233 Jul-21-2017, 04:16 PM
Last Post: nilamo
  serious n00b.. NLTK in python 2.7 and 3.5 pythlang 24 20,170 Oct-21-2016, 04:15 PM
Last Post: pythlang

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020