Python Forum
combining words and files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
combining words and files
#1
Hi,

I was wondering if someone could help me here as I could not find anything online and i am not an expert on python nor any programming, i just understand the basics and possibly more. :P

my brain has been fried for the last few days trying to figure this out.

I have 3 txt files. all with numbers. now I am trying to figure out a way to combine these numbers into all possible combinations and export to a third file but the numbers will need to be separated by a - for example:

1-2-3 3-2-1 2-3-1 and so on. and lets say I have 1 to 9 in on .txt file 10-99 in another and 100-200 on the third file. (example).


could someone kindly do this for me as I have absolutely no idea what i am doing lol.

Thanks.
Reply
#2
we are glad to help, but we are not great at doing your work.
read the numbers from each file in separate list. use itertools.product. Write the result to file.
Post your code in python tags, full traceback if you get any - in error tags, ask specific question.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

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