Good morning, Medium! Sorry for not making the Wednesday deadline for this weekly story, I stayed up way too late and was chatting with a friend. But now that I’m here, let’s get to business.
So What Have I Been Up To Lately?
We’ve got some stuff rolling lately. I’ve been doing some practice with File I/O, particularly with the csv module.
# More file I/O practice, with .csv files
import csv
name = input("What's your name? ")
home = input("Where's your home? ")
with open("guardians.csv", "a") as file:
writer = csv.DictWriter(file, fieldnames=["name", "home"]) # writer reads the csv files and deals with corner cases and stuff for us
writer.writerow({"name": name, "home": home}) # the writer writes the input to the csv, to its assigned column/variable
What’s going on here is this:
- Take input from the user on their name and home, and assign both outputs to their respectice variables.
- Open the “guardians.csv” file in append mode, to append our variables to it.
- Writer with csv.DictWriter, in the fields of name and home, which are columns in our csv file.
- Write to the rows beneath name and home with the values from the dictionary associated to name and home.
- Check the csv file for the output!
Pretty neat program If I do say so myself.
On top of that, Unity has been moving, a bit. I spent the past 2 days doing modelling work in Blender, then quickly remembered that Unity does NOT import textures from Blender. It could literally be that they’re completely different. But, extracting the materials in Unity will import the materials used from Blender, but not the values. This causes us top have a blank canvas as a weapon. Which is quite sad.
Regardless, I’m going to move on with development and fix all this material BS when I need to later on.
Final Thoughts
Before I go, I’ve got some stuff to tell you guys. Firstly, repositories for my CelesteClone platformer and Stellarscape are now public on Github. You guys can check them out on my profile.
Also, huge thanks to Alexandra Grosu, Ella Harris and Alex Rotar for the recent support on the past few Py Logs! Ya’ll are awesome!
And with that, I’ll see you guys this Friday with our final weekly story!