Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i need to ask the user to enter two strings and then store it in a text file as text.txt. Then, my program must read the contents of the file (1st line represents the 1st channel and the 2nd line represents the 2nd chain) and do the processing to display on the screen the 2 channels as well as the number of occurrences of the second chain in the first.

I know how to code this, my problem is that i dont know how to store my input in a text file.

What I have tried:

I tried to use a txt file but obvsiouly i cant put a code on it so i cant use the input command. (im new)
Posted
Updated 13-Jun-18 15:37pm
v2
Comments
Mohibur Rashid 13-Jun-18 18:55pm    
The is not clear and you have asked the same question before!
Member 13870077 13-Jun-18 21:35pm    
i need to ask the user to enter two strings and then store it in a text file as text.txt. Then, my program must read the contents of the file (1st line represents the 1st channel and the 2nd line represents the 2nd chain) and do the processing to display on the screen the 2 channels as well as the number of occurrences of the second chain in the first.

I know how to code this, my problem is that i dont know how to store my input in a text file.
Mohibur Rashid 13-Jun-18 22:34pm    
May be you need to show your code. Since you know some, show us that one
Patrice T 13-Jun-18 19:08pm    
Learn programming !
Dave Kreskowiak 13-Jun-18 19:49pm    
What does "stock an input in a file"? That doesn't make sense in English in the context of writing code.

Are you talking about writing user input to a file of some kind?

1 solution

Google for "Python write text file" and you'll find plenty of examples.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900