我正在处理我的项目pandas数据帧到csv文件。行是根据输入创建的,这就是我的意思:3所以问题是,当我循环脚本时,第一行一直在变化结果:3。还需要帮助循环脚本
from ast import Break
import pandas as pd
import socket
import webbrowser,time
def introduction():
msg = '''
This is a python project made by Abhay R
of ************************************.
This project is based on how internet
service providers collect
data from clientsnnnnn'''
for x in msg:
print(x, end='')
time.sleep(0.002)
wait = input('Press any key to continue.....')
introduction()
print()
def begin():
url=input("ENTER YOUR WEB HERE:")
web=webbrowser.open_new_tab(url)
weblink = url
Domain_name = ""
x = weblink.split("/")
if(x[0] == "https:" or x[0] == "http:"):
x = x[2].split(".")
else:
x = x[0].split(".")
if(len(x) == 2):
Domain_name = x[0]
else:
Domain_name = x[1]
print("Domain Name Is:",Domain_name)
dns=socket.gethostbyname(weblink)
print("DNS:",dns)
domain=Domain_name
dns=dns
data={"WEBSITE":weblink,"DOMAIN":domain,"DNS":dns}
df1=pd.DataFrame(data,index=[1])
df1.to_csv("C:\Users\stdev\Desktop\IP PROJECT\Book 9.csv")
cvv=pd.read_csv("C:\Users\stdev\Desktop\IP PROJECT\Book 9.csv")
print(cvv)
begin()
希望我的问题可以理解,任何人都可以尽快帮助我。
问题已经解决,谢谢@furas
import pandas as pd
import socket
import webbrowser,time
def introduction():
msg = '''
This is a python project made by Abhay R
of ************************************.
This project is based on how internet service providers collect
data from clientsnnnnn'''
for x in msg:
print(x, end='')
time.sleep(0.002)
wait = input('Press any key to continue.....')
introduction()
print()
def begin():
url=input("ENTER YOUR WEB HERE:")
web=webbrowser.open_new_tab(url)
weblink = url
Domain_name = ""
x = weblink.split("/")
if(x[0] == "https:" or x[0] == "http:"):
x = x[2].split(".")
else:
x = x[0].split(".")
if(len(x) == 2):
Domain_name = x[0]
else:
Domain_name = x[1]
print("Domain Name Is:",Domain_name)
dns=socket.gethostbyname(weblink)
print("DNS:",dns)
domain=Domain_name
dns=dns
data={"WEBSITE":weblink,"DOMAIN":domain,"DNS":dns}
def alt():
df=pd.DataFrame(data,index=[1])
df.to_csv("data.csv",index=False,mode='a',header=False)
print(df)
alt()
begin()
begin()