Python 3 Lesson 14: Save & Load Data

  Рет қаралды 42,160

Danny Murray

Danny Murray

6 жыл бұрын

Writing to a .py file and loading back in the values.

Пікірлер: 57
@gamergotdis2348
@gamergotdis2348 Жыл бұрын
Tysm this is all I needed for my programming project in school! I was trying to store user information but I failed multiple times, this really helped 10/10 thank you again.
@CLyon-cc9jp
@CLyon-cc9jp Жыл бұрын
I never would have thought of using a python extension over a text extension to save my program data. Perfect! Saves so much time not having to parse every entry. Nice.
@Nezuzo
@Nezuzo 11 ай бұрын
Thank you so much man, so simple and easy to understand.
@faisaltaher851
@faisaltaher851 6 жыл бұрын
thx you so much you helped me with a problem the was happening for 2 day FREAKING 2 DAY thx you, you solved my problem :)
@robertovargas5839
@robertovargas5839 Жыл бұрын
This is super tedious if implemented even on a small text based game but its good to see there is a way of getting it done.
@BiggestNaviaFan
@BiggestNaviaFan 4 ай бұрын
thanks a lot this helps with my text based boss fighter
@dofnithedope3758
@dofnithedope3758 3 жыл бұрын
THANK YOU!!! I have been trying to figure out how to do this and literally every other tutorial was just too complicated for my small brain.
@ashmeepragnaroy8976
@ashmeepragnaroy8976 2 жыл бұрын
Thanks a lot!! This was a way of saving user data permanently! Thanks again!
@blackblocky3866
@blackblocky3866 Жыл бұрын
very good tutorial, thanks!
@richitomiau.
@richitomiau. Жыл бұрын
tysm u make it so easy to understand and save my time
@zeperoxx
@zeperoxx 4 жыл бұрын
Thx, it helped a lot, especially I didn't have any success before. Every video or post I find only shows how to write a sentence, not full variable
@EJStudios17
@EJStudios17 4 жыл бұрын
If you have separate def’s it gives a name error. Is their a fix for this?
@ktz2625
@ktz2625 3 жыл бұрын
How can I save and load a string (name = "KTZ") because I can't put the "" in the f.write function. Please help.
@TaFr-mg5dy
@TaFr-mg5dy 7 ай бұрын
Thank you for your useful tutorial
@rafy-ivanmorales3077
@rafy-ivanmorales3077 2 жыл бұрын
Rafy-Ivan Morales 0 seconds ago I'm a new student trying to learn, so I can become a programmer with python and I have a project on how to make a port scan. So far I already make a port scan with Python3, and it scans fine, give a date and everything working good so far. I see on your video tutorial you give example on how to send and receiving data. I would like to ask for your advice if you can and guide me on how I will add this 3 in a Python script, I have: 2. System should look for all the ports between the range of 1 to 1025 3. If the Ports is open, it should create a file and add an entry for port number 4. In case of any exception for instance “host is not available”, “host name could not be resolved” or due to any other error, you need to write that exception into the same file. Thank you and Merry Christmas.
@Prosecute_V
@Prosecute_V 2 жыл бұрын
guud
@xNezrx
@xNezrx Жыл бұрын
Thank you so much!
@tops_10-20
@tops_10-20 Жыл бұрын
Explanation : 100 / 100
@Devtheking
@Devtheking Жыл бұрын
Thank you!
@ohtych1004
@ohtych1004 4 жыл бұрын
How could I delete what was on the second file? Like in this example, if I wanted to delete the health from the Savytime.py file?
@psychic_digit
@psychic_digit 3 жыл бұрын
I think you just have to overwrite it to 0 or something.
@quirkychamp9152
@quirkychamp9152 4 жыл бұрын
thank you so much i look a lot for that
@corn3237
@corn3237 3 жыл бұрын
I can’t thank you enough. Thanks you so much. You have saved me literally hours more of stress. I’ve tried to make multiple save files but it always gave me a error, is there a way?
@DanielMurrayMakes
@DanielMurrayMakes 3 жыл бұрын
What's the error say?
@sirng1272
@sirng1272 4 жыл бұрын
Thanks
@yosuo8472
@yosuo8472 7 ай бұрын
W mans
@ifaisalne9781
@ifaisalne9781 2 жыл бұрын
Man you are really pro, i have a Q Can you tell me how to save a word like True False value in py file ?
@orangeleaf36
@orangeleaf36 3 жыл бұрын
What about for saving a string?
@sandpaperunderthetable6708
@sandpaperunderthetable6708 3 жыл бұрын
How do you check if a file exists? Do you use a try and catch and open a file for read? Does that work?
@DanielMurrayMakes
@DanielMurrayMakes 3 жыл бұрын
Yes a Try would work there, good idea!
@sandpaperunderthetable6708
@sandpaperunderthetable6708 3 жыл бұрын
@@DanielMurrayMakes thanks
@sandpaperunderthetable6708
@sandpaperunderthetable6708 3 жыл бұрын
@@DanielMurrayMakes will opening a non existant file to read cause an error?
@DanielMurrayMakes
@DanielMurrayMakes 3 жыл бұрын
@@sandpaperunderthetable6708 Yeah but of you use Try with an Except then it will just jump over to the except. Bad coding probably but it'll work!
@dorgan8777
@dorgan8777 4 жыл бұрын
Thanks I'm currently working on a text based os called red warp
@hayderalanbari6740
@hayderalanbari6740 3 жыл бұрын
How is it going?
@matthewwhite3744
@matthewwhite3744 3 жыл бұрын
Yeah how's it going?
@ProFNaFPlayer._1987
@ProFNaFPlayer._1987 Жыл бұрын
It just doesnt work. The file isn't showing up , and when I created the file by myself , It's empty
@Greg2
@Greg2 2 жыл бұрын
How do I make it so everytime I run the command, it sends how many times I have ran the file?
@ProFNaFPlayer._1987
@ProFNaFPlayer._1987 Жыл бұрын
I know the answer , still wanna know?
@theprogrammer1903
@theprogrammer1903 3 жыл бұрын
i subbed
@unrealnovice7330
@unrealnovice7330 4 жыл бұрын
UnboundLocalError: local variable 'loseCount' referenced before assignment ??? its pretty usless if i cant change bevor im loading
@unrealnovice7330
@unrealnovice7330 4 жыл бұрын
def Lose(): Clear() loseCount = loseCount + 1 print("Du hast verloren :( " + str(loseCount) + "x insgesammt verloren ") input("Press any key") Restart()
@unrealnovice7330
@unrealnovice7330 4 жыл бұрын
def Save(): f = open("SaveFile.py",mode="w") wins = f.write("winCount = " + str(winCount) + " ") loses = f.write("loseCount = " + str(loseCount) + " ") f.close()
@quirkychamp9152
@quirkychamp9152 4 жыл бұрын
see i was hoping to have it were i can just input the data but it kept saying i cant do varibels for the word that in the string for write
@DanielMurrayMakes
@DanielMurrayMakes 4 жыл бұрын
Copy-paste the exact error here, maybe I can help
@quirkychamp9152
@quirkychamp9152 4 жыл бұрын
Ow I fixed it already thx you so much
@quirkychamp9152
@quirkychamp9152 4 жыл бұрын
I'm new to this so ya
@quirkychamp9152
@quirkychamp9152 4 жыл бұрын
Big fan
@KlaroNebulous
@KlaroNebulous 3 жыл бұрын
for me it only saves the data in the first line idk why
@adamhall7077
@adamhall7077 2 жыл бұрын
Did you put the " " in? You might have put a "/n" instead.
@ThatGuyexe
@ThatGuyexe 3 жыл бұрын
loll so cool
@ringingstrings6078
@ringingstrings6078 3 жыл бұрын
How do I Put my "Saveytime" in another folder and open it
@survivalist2607
@survivalist2607 3 жыл бұрын
instead of "from Saveytime import *" put "from yourfoldernamehere import *" or "from yourfoldernamehere import Saveytime" but you'll have to put a "Saveytime." before any variables that are getting pulled from the File, to shorten it put "from yourfoldernamehere import Saveytime as namehere" that way, you'll have to put "namehere." before every variable getting pulled from there. Ofcourse you can put something else other than namehere, it was used as an example.
@rakawiratama
@rakawiratama Жыл бұрын
can we customize the location of the saved file? In my case it is always saved in C/Users/(My username)/... and I want to save it somewhere else
@mr.broken5539
@mr.broken5539 Жыл бұрын
hey! i have the same problem, have you found the solution? luckily u posted this comment 2 days ago so i hope u can answer haha
@spookyleo2589
@spookyleo2589 Жыл бұрын
if ur file name is kitty you have to do like C:/DeskTop
Python Tutorial 14: Saving and Reading Data Files With Pickle
22:57
Paul McWhorter
Рет қаралды 28 М.
Python Tutorial: File Objects - Reading and Writing to Files
24:33
Corey Schafer
Рет қаралды 1,7 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 15 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 170 #shorts
00:27
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 8 МЛН
Python dataclasses will save you HOURS, also featuring attrs
8:50
How to store data with Python and SQLite3
9:15
John Watson Rooney
Рет қаралды 42 М.
Python GUI save a file (filedialog) 💾
10:26
Bro Code
Рет қаралды 41 М.
This INCREDIBLE trick will speed up your data processes.
12:54
Rob Mulla
Рет қаралды 258 М.
Python: How to Save and Load Data for Beginners
6:08
TokyoEdtech
Рет қаралды 102 М.
WHAT Is "Pickle" In Python?! (EXTREMELY Useful!)
9:32
Indently
Рет қаралды 75 М.
Python 101: Learn the 5 Must-Know Concepts
20:00
Tech With Tim
Рет қаралды 1,1 МЛН
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,3 МЛН
How to Save and Load Data in Python Using JSON Files | Python JSON Module
13:06
Fabio Musanni - Programming Channel
Рет қаралды 8 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,4 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 15 МЛН