insert data in python script

alberto voodoo.bender at gmail.com
Tue Feb 18 10:52:41 EST 2020


Il giorno martedì 18 febbraio 2020 11:01:11 UTC+1, David ha scritto:
> On Tue, 18 Feb 2020 at 20:45, alberto <voodoo.bender at gmail.com> wrote:
> > Il giorno martedì 18 febbraio 2020 09:34:51 UTC+1, DL Neil ha scritto:
> 
> > > > my code preos in one file preos.py
> > > > my commands are
> > > >
> > > > alberto at HENDRIX ~/PREOS $ python3.5
> > > > Python 3.5.2 (default, Oct  8 2019, 13:06:37)
> > > > [GCC 5.4.0 20160609] on linux
> > > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>>> import preos
> > > >>>> methane = Molecule("methane", -82.59 + 273.15, 45.99, 0.011)
> > > > Traceback (most recent call last):
> > > >    File "<stdin>", line 1, in <module>
> > > > NameError: name 'Molecule' is not defined
> 
> > honestly i don't understand what i have to do.
> 
> $ python3
> Python 3.5.3 (default, Sep 27 2018, 17:25:39)
> [GCC 6.3.0 20170516] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print(digits)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'digits' is not defined
> >>> print(string.digits)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'string' is not defined
> >>> import string
> >>> print(digits)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'digits' is not defined
> >>> print(string.digits)
> 0123456789
> >>>

Hi, 
I solve it with external file as follows

import preos
# pass name, Tc, Pc, omega
methane = preos.Molecule("methane", -82.59 + 273.15, 45.99, 0.011)
methane.print_params()

thanks to everyone

regards

Alberto


More information about the Python-list mailing list