Python How to Program Pt 5

preview_player
Показать описание
Python How To Video : Here I show you how to read from and write to files with Python. Also, go over a bunch of other tricks along the way.

Рекомендации по теме
Комментарии
Автор

If you can read and understand a file type with your eyes then you can teach a program to do the same thing with regular expressions. I have a bunch of regular expression tutorials that will help you learn that topic

derekbanas
Автор

A couple things could cause a problem. One thing is that you need to make sure the whitespace is used the right way. Also, you may have to do a find and replace to change the backquotes into normal quotes. That was an old security feature I used to have to use. Tell me if that helps, or not

derekbanas
Автор

@CoreOFDeath007 Eclipse is the editor you enter the code into. Python compiles and executes the code

derekbanas
Автор

Thank you :) I appreciate your kind words

derekbanas
Автор

Thank you very much :) A ton more Java videos are in the works. The next one will come out tomorrow.

I doubt I'll ever be that big though, but that is ok

derekbanas
Автор

I'm going to address some of these PC issues and also do a tutorial on setting up python on a pc. Thank you for your patience :)

derekbanas
Автор

Anything you can do manually can be done by teaching the computer what to look for using regular expressions. You'll just have to break the process down into a series of steps to accomplish that. I use UML to make stuff like you are describing. My UML tutorials may help you better understand the process. I wish you luck with your project

derekbanas
Автор

@supercaleb08 If you copied the code from the website do a find replace to turn all back quotes into regular quotes. You shouldn't have any problems after that.

derekbanas
Автор

you are going to next youtube big thing Derek... God bless you... you are a life saver espically in you new java videos i've seen all of these 37 and looking forward for no 38 and onwards... thanks a ton buddy... i really love your videos....

UCBCteam
Автор

Firstly, thanks 4 your very swift response. Things that I found:
*I was guilty of a few typos - hence why code didnt work
*Windows/Python backslash compatibility issue: ‘Your file name has backslash characters in it. Backslash is the escape character in Python strings. Either replace them with '/' characters or use
*Changed single inverted commas into double inverted commas. This got strings to turn green whereas single inverted commas didnt have this effect.

stcentdigital
Автор

Thats what I'm talkin bout homey. Love it. Simple but effective.

gent
Автор

Thank you :) I'm writing to text (txt) files. Check to make sure the files are being created in your directory. You may have a permissions issue if you are on Windows and they aren't showing up. That just means you'll need to install Python outside of your Program Files directory. Something like c:\Python will work

derekbanas
Автор

My java tutorial shows you how to make games. Before the end of the year Ill be starting a large game development tutorial

derekbanas
Автор

@SpruzoEntertainment Thank you. I'm not that popular on YouTube, but thats ok :)

derekbanas
Автор

Great! I'm glad to have been of help :)

derekbanas
Автор

@tomismore I'm glad you like them :) I have the code on my newthinktank site for free. If you send me an email in a yt tube message I can send you the code. The error is probably coming from an error some where else in the code.

derekbanas
Автор

Save it in the same directory as your python file

derekbanas
Автор

You're doing a great job!  I appreciate these tutorials!

JoM
Автор

Look for this tutorial for file stuff Python 2.7 Tutorial Pt 10. REGEX Tutorial Regular Expressions covers regex in python. They are both on my YouTube channel. I hope they help

derekbanas
Автор

f = open('studentgrades.txt')
for line in f:
    print(line, end="")
f.close()

this is the exact code ive been using in eclipse (yes i have pydev installed and everything) but i get a syntax error saying that "=" is an incorrect syntax) I'am using python 3.3 so maybe there is something else I'am suppose to type.

thanks a lot Derek you've been helping me prepare for university with the other videos.

ThatPortgueseKid