Message from Python discussions

December 2018

— Could I use args if I run a script with python3 -m appname ?


Google didn't help

Can I use append mode for writing in a new file?
I know that there is 'w' mode for writing into not existing file.
But will it work if I go with 'a' mode?

I am using to_csv, btw

— It did

— I have a large txt file with nearly 10,000 line and 20 columns.

I want to split them and append them into variables,

but the problem is that the columns are un evenly separated. That means, at some places the separation is just 1 space, and other it's a Tab...

I tried to split this with

 line.split(" ") 


both of them are not working correctly, they are splitting it the wrong way.

any way to split this easily? a picture of the file is attached.

Message permanent page

— What happens if you use line.split(' ')

— *line.split()

— Yes, try split() with no arguments

— Looks like that's an old script


AttributeError: module 'port_setup' has no attribute 'port_setup_win'

i want to add a func from py file to another i.e from port_setup to the other.
but i get the error above..

Message permanent page

— Ok guys thanks...
line.split() worked.


Traceback (most recent call last):
File "C:/Users/MDavid/Desktop/meaCli_Gui/", line 6, in <module>
from port_setup import port_sp
File "C:\Users\MDavid\Desktop\meaCli_Gui\", line 3, in <module>
from main import server,main_window,main_output
File "C:\Users\MDavid\Desktop\meaCli_Gui\", line 6, in <module>
from port_setup import port_sp
ImportError: cannot import name 'port_sp' from 'port_setup' (C:\Users\MDavid\Desktop\meaCli_Gui\

Message permanent page

— I have a problem with the imports i need stuff from main file in port_setup file and the oposite (from port_setup to main).
How to solve this collision?

Message permanent page