Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,608 members, 7,958,845 topics. Date: Thursday, 26 September 2024 at 05:35 AM |
Nairaland Forum / Science/Technology / Programming / Python Gurus In The House Help With This Questions (975 Views)
Gurus In The House: Macbook Or Windows, Which Is Best For Programming ? / Python Gurus Please Help Me With This Code. / New To Python, Gurus Please Help Solve These Challenges. Thanks. (2) (3) (4)
Python Gurus In The House Help With This Questions by Nobody: 6:27am On Jul 05, 2022 |
HOW DO I CREATE PYTHON SCRIPT TO OPEN FILES SAVED AS TEXT FILE AND DISPLAY THE TEXT LINES?? |
Re: Python Gurus In The House Help With This Questions by Golan007: 6:36am On Jul 05, 2022 |
with open('readText.txt') as f: lines = f.readlines() 1 Like |
Re: Python Gurus In The House Help With This Questions by Nobody: 7:47am On Jul 05, 2022 |
Golan007: The filename will be in the readtext space right? E.g I saved my document file scantext.tx Which part of the pycharm do I type that command? In the terminal or the pycharm window? |
Re: Python Gurus In The House Help With This Questions by Golan007: 7:56am On Jul 05, 2022 |
bruno10000: Please do it in your pycharm window. 1 Like |
Re: Python Gurus In The House Help With This Questions by Nobody: 8:08am On Jul 05, 2022 |
T |
Re: Python Gurus In The House Help With This Questions by Excallibur(m): 8:15am On Jul 05, 2022 |
Try print(lines) 1 Like 1 Share |
Re: Python Gurus In The House Help With This Questions by Golan007: 9:22am On Jul 05, 2022 |
bruno10000: Place this after: Print(lines) |
Re: Python Gurus In The House Help With This Questions by Nobody: 9:49am On Jul 07, 2022 |
Golan007 please how do I update a script and then print corresponding information in two different text files Excalibur |
Re: Python Gurus In The House Help With This Questions by Golan007: 11:58am On Jul 07, 2022 |
bruno10000: With open('nono.txt', 'r') as f: lines = f.readlines() for line on lines: print(line) Updated_lines = ["", "I don't care if your name is Jojo\n", "Just dance for me"] with open('nono.txt', 'a') as Ap: new_updates = Ap.writelines('\n'.join(Updated_lines)) print(new_updates) |
Re: Python Gurus In The House Help With This Questions by Golan007: 12:01pm On Jul 07, 2022 |
You need something like with open('first.txt', 'r') as firstfile, open('second.txt', 'a') as secondfile: for line in firstfile: secondfile.write(line) |
Re: Python Gurus In The House Help With This Questions by Golan007: 12:01pm On Jul 07, 2022 |
If not exact, you need to figure it out. That's what makes you better. |
Re: Python Gurus In The House Help With This Questions by Nobody: 12:20pm On Jul 07, 2022 |
Okay, thanks sir. I'll put this codes to use now and try to work my way around the whole thing. |
Re: Python Gurus In The House Help With This Questions by jesmond3945: 12:29pm On Jul 07, 2022 |
bruno10000:lol. Google can help you. 1 Like |
Re: Python Gurus In The House Help With This Questions by Nobody: 12:49pm On Jul 07, 2022 |
jesmond3945: It's so hard coming by the ans on google |
Re: Python Gurus In The House Help With This Questions by jesmond3945: 1:20pm On Jul 07, 2022 |
bruno10000: 1 Like
|
Re: Python Gurus In The House Help With This Questions by Nobody: 10:08am On Jul 15, 2022 |
[quote author=jesmond3945 post=114506754][/quote] Golan007 Thanks guys, your contributions to my test ...was really helpful. Please can you guys suggest any video link for me to download in order to understand using the with statement for files, networking etc Or any video link to understand python statements more at this level because I have so much assignment coming up Thanks y'all |
Re: Python Gurus In The House Help With This Questions by jbreezy: 10:13am On Jul 15, 2022 |
Just go and read Python Crash Course from the beginning to the end. Everything you need to know as a python beginner is provided inside that gem. 1 Like |
Re: Python Gurus In The House Help With This Questions by Golan007: 10:21am On Jul 15, 2022 |
bruno10000: https://www.youtube.com/watch?v=Uh2ebFW8OYM |
Re: Python Gurus In The House Help With This Questions by Nobody: 11:37am On Jul 15, 2022 |
1 Like |
(1) (Reply)
Wxwidgets Coderz Any1? / Warning To All Programmers ! / Java Beginner
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16 |