Hello, I'm very new to python and programming in general. Basically what I need to do is take a csv, look at the first row and if it says something (say 'D'), then read the contents of the colum. Then I want to copy the rows that contain a certain value (say all rows that have '0' in column 'D'). From this I want to construct a new csv that has all of the rows with the same value for column D. A,B,C,D 1,X,3,0 2,Y,2,1 3,Z,1,0 So from this I want: A,B,C,D 1,X,3,0 3,Z,1,0 ...etc
@AJALA1999 You might want to join the Python Tutor Mailing List to get help like this. They will answer just about any Python question (as long as you've tried to figure out the answer yourself). Very nice people. And of course anyone on the list can help you, but they have mods who always answer your questions too.
hi newboston your tutorials are really good but i would like to know if you have a tutorial to open edit and close CSV files using python that would be great!!!
hi newboston your tutorials are really good but i would like to know if you have a tutorial to open edit and close CSV files using python that would be great!!
Instead of readline, which reads line for line, readlines reads line by line, each line, into a list. So instead of just returning the lines, line, line, line at a time. It takes all the lines and returns them line by line but it does it as a list. Or something along that line. ROFL
I'm watching like 5 of these at a time and writing almost everything he does in a notebook. Then I try to figure out what kind of simple prog would use the stuff I just learned. So far I've done Mad Libs, simple bill calculators, and then "deluxe" versions of the same progs and stuff like that. The notes really help, but the incorporating of info into something I wrote myself REALLY helps. So if you're having trouble, try something similar. I'm having a LOT of fun. These vids are SUPERB.
I couldn't see the text file that he added the 4 lines to, but whatever.
a90380 5 days ago
hey typed the backslash exactly 3 times throughout the entire series
vimmy2492 1 month ago in playlist Python Programming Tutorials
pure and simple, you are the best bucky!
Cantinflat 2 months ago
If anyone here is a Python Coding Legend please message me :)
m33taphor 6 months ago
@m33taphor that's me
ThePokemonteacher 4 months ago
@m33taphor Which python coding legend would watch beginner tutorials? Yeah, all n00bs here! Including me! :P
supersushi269 1 month ago
The best python tutorial I have ever seen, make learning happy and easy.Hope this series will keep going and introduce more advanced features.
Keep Moving , buddy. We all love it !!!!
KenjiChen1 6 months ago
lol he always hits that forward slash \ key
Kamilk12l 6 months ago
AJALA1999 9 months ago
@AJALA1999 You might want to join the Python Tutor Mailing List to get help like this. They will answer just about any Python question (as long as you've tried to figure out the answer yourself). Very nice people. And of course anyone on the list can help you, but they have mods who always answer your questions too.
Colstonewall 3 months ago in playlist More videos from thenewboston
do yo have a tutorial to open edit and close CSV file with python?
AJALA1999 9 months ago
This has been flagged as spam show
hi newboston your tutorials are really good but i would like to know if you have a tutorial to open edit and close CSV files using python that would be great!!!
AJALA1999 9 months ago
hi newboston your tutorials are really good but i would like to know if you have a tutorial to open edit and close CSV files using python that would be great!!
AJALA1999 9 months ago
>>> fob.readlines()
['lineone\n', 'linetwo\n', 'linethree']
>>> fob.read(25)
''
>>> fob.read(5)
''
>>> fob.readlines()
[]
>>>
great job Python, suddenly my lines disappear, but not in the .txt folder
onon6 10 months ago
If you want to let the user input text for the file,
use this:
text=raw_input("Write text for file here: ") fob.write(text.replace("\\n", "\n"))
joaoris 11 months ago
Correct me if im wrong but is is possible to use fob to open any file or another program such as the command prompt like is you put fob('c:/cmd.bat')
Gmez1407 11 months ago
@Gmez1407 haha i doubt it but very good question tell me if you figure it out.
PurpleSpawner85 11 months ago
Instead of readline, which reads line for line, readlines reads line by line, each line, into a list. So instead of just returning the lines, line, line, line at a time. It takes all the lines and returns them line by line but it does it as a list. Or something along that line. ROFL
ShadeRunners 1 year ago
breaky u lie :( u always say this "\" doesnt mean anything but i dont believe u :)
Rroundabout 1 year ago
Let's go head!
:)
CopperHeart0718 1 year ago
What about changing some positions on each line. Like position 6-10 to ABCDE.
Would be usefull.
Thanks for great tutorials.
Myrslokstok 1 year ago
can you read dll or exe files without getting difficult code like x00 x01 ect. ????
jorankk 1 year ago
Why is the first line not shown up in fob.readlines?
blower05 1 year ago
@blower05 He had already read the first line above.
EldMage 1 year ago
@TheBoyyini If you've been watching for about 2 hours, you shouldn't be this far should you...?
kyle2120 1 year ago
Yet another great tutorial. Keep up the great work!
Anthony0Jeffries 1 year ago
I'm watching like 5 of these at a time and writing almost everything he does in a notebook. Then I try to figure out what kind of simple prog would use the stuff I just learned. So far I've done Mad Libs, simple bill calculators, and then "deluxe" versions of the same progs and stuff like that. The notes really help, but the incorporating of info into something I wrote myself REALLY helps. So if you're having trouble, try something similar. I'm having a LOT of fun. These vids are SUPERB.
GrantOnTheRocks 1 year ago 2
thanks a lot~~
lyrebaby 1 year ago
For the newbies:
The original file had 3 lines:
whats ur name
my anmes bucky
tell ur mom the same
After using the write command, the original contents of the file are lost and the new file only has four lines (not seven):
this is a new line
this is line 2
this is third line
this is the last ANd final line
Kojow7 2 years ago
The original file had 4 lines
hey now borwn cow
whats ur name
my anmes bucky
tell ur mom the same
just to be precise...
pilitsos2 2 years ago 3
2:30
pilitsos2 2 years ago
pilitsos2, yes, you are absolutely right, the original file had 4 lines. Thanks for the correction!
Kojow7 2 years ago
this is hard
Scottk95 2 years ago
Of course it is, go to tutorial 1
xXdaveXsuperstarXx 2 years ago
lol i have watched all of them. anway i dont use this anymore.
Scottk95 2 years ago
Huh? Wait, so you're saying you've quit programming or you moved to a more advanced language.
xXdaveXsuperstarXx 2 years ago
yah
Scottk95 2 years ago
@Scottk95
it's not hard, but it takes focus/commitment-
that's what makes it good :) if it was easy and everyone knew it, then to me, it loses it's value.
sekulr 2 years ago
LOL tell ur mom the same time
10spades 2 years ago 41
yep, thanks
eromandra 2 years ago 2
I am just going to have to believe you on the lines :). Couldn't see crap
braane1 2 years ago 66
Thx for all the vids!
Samppf 2 years ago 3