Created
January 4, 2023 15:45
-
-
Save NajaTorx/232180f5a686da949d23855d252fe77b to your computer and use it in GitHub Desktop.
Import Dateien
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CSV was funktioniert | |
import pandas as pd | |
df = pd.read_csv("D:\Python\Vokabeltrainer\englisch.csv", | |
sep=";", | |
header=0, | |
#encoding = "latin1", sollte Umlaute anpaasen, aber zerstört sie | |
names=["Deutsch", | |
"Englisch"], | |
dtype = {"Deutsch":str, | |
"Englisch":str}) | |
print(df) | |
# was nicht funktioniert | |
import pandas as pd | |
df = pd.read_excel("D:\Python\Vokabeltrainer\englisch.xlsx") | |
print(df) | |
datei = open("D:\Python\Vokabeltrainer\englisch.csv").readlines() | |
def listToString(datei): | |
# Erstellung leerer String | |
str1 = "" | |
# Übergabe an String | |
return (str1.join(datei)) | |
print(listToString(datei)) | |
# noch ne Methode zum Listen lesen, was funktioniert - aber nicht mit Excel | |
vokabeln = open("D:\Python\Vokabeltrainer\englisch.csv").readlines() | |
for i in vokabeln: | |
print(i,end=" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment