Two locations for module struct ?

Chris Angelico rosuav at gmail.com
Fri Nov 14 17:24:56 CET 2014


On Sat, Nov 15, 2014 at 2:11 AM, ast <nomail at invalid.com> wrote:
> In module wave there is a sub module struct.
> You can call function pack() with:
>
> import wave
> val = wave.struct.pack(...)
>
> but the same function can be called with:
>
> import struct
> val = struct.pack(...)
>
> Is it exactly the same module in both location ?
> Why putting struct in two places ?

I don't think that's a submodule of wave. It's just the standard
struct module, which presumably wave imported. Use it as struct, not
as wave.struct.

ChrisA



More information about the Python-list mailing list