Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex help for newbie
#2
You need to add from __future__ import print_function and pass file keyword to the print function, e.g. print(x, file=y) or use y.write('{}\n'.format(x)). This should work, but not tested.
Why did you still using Python 2.x? If you have digits after car of truck words, it would be better to use a regexp something like this re.compile("car\d+").
Reply


Messages In This Thread
Regex help for newbie - by mcmpdx - Jul-01-2019, 12:15 AM
RE: Regex help for newbie - by scidam - Jul-01-2019, 01:07 AM
RE: Regex help for newbie - by mcmpdx - Jul-01-2019, 02:35 AM
RE: Regex help for newbie - by perfringo - Jul-01-2019, 06:54 AM
RE: Regex help for newbie - by mcmpdx - Jul-01-2019, 04:50 PM
RE: Regex help for newbie - by ichabod801 - Jul-01-2019, 06:17 PM
RE: Regex help for newbie - by mcmpdx - Jul-01-2019, 10:21 PM

Forum Jump:

User Panel Messages

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