Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Carlo Miron
2018-02-27 18:20 GMT+01:00 Iguana Igua :

> Per esempio io voglio conoscere la descrizione di un pacchetto.
> So che il pacchetto è python2.7 e che lo trovo dentro la cache.
> Quindi:
> cache=apt.Cache()
> pkg=cache['python2.7']
> e da qui come arrivo a:
> pkg.version[0].description
> ?
> cioè come faccio a trovare description ?

```
>>> import apt
>>> cache=apt.Cache()
>>> pkg=cache['python2.7']
>>> ver=pkg.versions[0]
>>> dir(ver)
['__class__', '__delattr__', '__dict__', '__doc__', '__eq__',
'__format__', '__ge__', '__getattribute__', '__gt__', '__hash__',
'__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_cand',
'_cmp', '_records', '_translated_records', '_uris', 'architecture',
'dependencies', 'description', 'downloadable', 'enhances',
'fetch_binary', 'fetch_source', 'filename', 'get_dependencies',
'homepage', 'installed_size', 'is_installed', 'md5', 'origins',
'package', 'policy_priority', 'priority', 'provides',
'raw_description', 'recommends', 'record', 'section', 'sha1',
'sha256', 'size', 'source_name', 'source_version', 'suggests',
'summary', 'tasks', 'uri', 'uris', 'version']
>>> type(ver)

>>> help(apt.package.Version)
```

㎝

-- 
| THE -WARE LICENSE (Revision ㊷)
| --
|  wrote this mail. As long as you retain
| this notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a  in return. -- Carlo Miron
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Alessandro Dentella
On Tue, Feb 27, 2018 at 06:20:14PM +0100, Iguana Igua wrote:
>  Se lo assegni ad un nome locale poi il tab ti mostra l'attributo
>  documentation.
>
>ok, ho capito.
>ma non ho capito la logica per arrivare al metodo. Facciamo le cose al
>contrario.
>Per esempio io voglio conoscere la descrizione di un pacchetto.
>So che il pacchetto è python2.7 e che lo trovo dentro la cache.
>Quindi:
>cache=apt.Cache()
>pkg=cache['python2.7']
>e da qui come arrivo a:
>pkg.version[0].description
>?
>cioè come faccio a trovare description ?
>

Senza avere visto cosa fa il tuo comando, credo che ti stia
suggerendo di fare:

>pkg.version[0].description

 pkg_version = pkg.version[0]

a questo punto, dentro ipython, puoi usare la tabulazione ed il '?' in
fondo per avere completamento ed informazioni.

Il meccanismo funziona se hai notazione puntata, ma non espande se hai un
un indice [].

sandro
*:-)
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Iguana Igua
2018-02-27 14:24 GMT+01:00 Andrea D'Amore :

> 2018-02-27 13:02 GMT+00:00 Iguana Igua :
>
> > dove trovo il metodo description nella documentazione ?
>
> A [1], piuttosto dove lo stavi cercando?
>
>
lo cercavo nell'help della console di python.


> > anche da iPython usando il tab dopo [0]. non mi dice che ci sono dei
> > metodi...
>
> Perché stai usando subscript e l'interprete non sa cosa verrà restituito.
> Se lo assegni ad un nome locale poi il tab ti mostra l'attributo
> documentation.
>
>
ok, ho capito.
ma non ho capito la logica per arrivare al metodo. Facciamo le cose al
contrario.
Per esempio io voglio conoscere la descrizione di un pacchetto.
So che il pacchetto è python2.7 e che lo trovo dentro la cache.
Quindi:
cache=apt.Cache()
pkg=cache['python2.7']
e da qui come arrivo a:
pkg.version[0].description
?
cioè come faccio a trovare description ?



>
> [1]: http://apt.alioth.debian.org/python-apt-doc/library/apt.
> package.html#apt.package.Version.description
>
> --
> Andrea
> ___
> Python mailing list
> Python@lists.python.it
> https://lists.python.it/mailman/listinfo/python
>
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Carlos Catucci
> > dove trovo il metodo description nella documentazione ?
>
>  package.html#the-version-class>
>

​oppure

dir(packagename)​

esempio

dir( os )

oppure

dir( os.path )

​dalla console python stessa​


​Carlos​

-- 
EZLN ... Para Todos Todo ... Nada para nosotros
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Andrea D'Amore
2018-02-27 13:02 GMT+00:00 Iguana Igua :

> dove trovo il metodo description nella documentazione ?

A [1], piuttosto dove lo stavi cercando?

> anche da iPython usando il tab dopo [0]. non mi dice che ci sono dei
> metodi...

Perché stai usando subscript e l'interprete non sa cosa verrà restituito.
Se lo assegni ad un nome locale poi il tab ti mostra l'attributo documentation.


[1]: 
http://apt.alioth.debian.org/python-apt-doc/library/apt.package.html#apt.package.Version.description

-- 
Andrea
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


Re: [Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Carlo Miron
2018-02-27 14:02 GMT+01:00 Iguana Igua :

> Vorrei capire come devo consultare la documentazione di una libreria.
> Vi faccio un esempio concreto.
> import apt
> cache=apt.Cache()
> pkg=cache['python2.7']
>
> ora dall'interprete:
>
> In [38]: pkg
> Out[38]: 
> In [39]: pkg.versions
> Out[39]:  '2.7.12-1ubuntu0~16.04.2', '2.7.11-7ubuntu1']>
> In [40]: pkg.versions[0].description
> Out[40]: u'Python is a high-level, interactive, object-oriented language.
> Its 2.7 version includes an extensive class library with lots of goodies for
> network programming, system administration, sounds and graphics.'
>
> dove trovo il metodo description nella documentazione ?



㎝

-- 
| THE -WARE LICENSE (Revision ㊷)
| --
|  wrote this mail. As long as you retain
| this notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a  in return. -- Carlo Miron
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python


[Python] ciao sono nuovo, ma si trova la documentazione ?

2018-02-27 Per discussione Iguana Igua
ciao, sono nuovo, non sono un programmatore ma mi sto dilettando (cioè sono
un niubbo).
Volevo fare una domanda la cui risposta mi sarebbe molto utile.
Vorrei capire come devo consultare la documentazione di una libreria.
Vi faccio un esempio concreto.
import apt
cache=apt.Cache()
pkg=cache['python2.7']

ora dall'interprete:

In [38]: pkg
Out[38]: 
In [39]: pkg.versions
Out[39]: 
In [40]: pkg.versions[0].description
Out[40]: u'Python is a high-level, interactive, object-oriented language.
Its 2.7 version includes an extensive class library with lots of goodies
for network programming, system administration, sounds and graphics.'

dove trovo il metodo description nella documentazione ?
anche da iPython usando il tab dopo [0]. non mi dice che ci sono dei
metodi... se faccio help(apt) e guardo cache mi dice mi ritorna un oggetto
Package quindi faccio help(apt.Package) e trovo versions che mi dice che mi
ritorna un oggetto VersionList quindi faccio help(apt.package.VersionList)
ma non riesco a trovare il metodo description...
HELP!!

grazie per l'aiuto.
___
Python mailing list
Python@lists.python.it
https://lists.python.it/mailman/listinfo/python