[Q] ImportError by __import__() on Python >= 3.4

Makoto Kuwata kwa at kuwata-lab.com
Thu Jun 2 19:54:00 EDT 2016


On Thu, Jun 2, 2016 at 11:15 PM, Michael Selik <michael.selik at gmail.com>
wrote:

>
>
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <kwa at kuwata-lab.com> wrote:
>
>>             os.mkdir(name)
>>             with open(name + "/__init__.py", 'w') as f:
>>                 f.write("X=1")
>>                 f.flush()
>>
>> Please give me any advices or hints.
>>
>
> This wasn't your question, but you don't need to flush the file. The
> ``with`` statement will automatically flush and close your file for you
> after you exit the block.
>

Thanks. I'm sure that with-statement close file, but not sure whether it
flushes or not.


Any hints or advices for ogiginal question?

--
regards,
makoto



More information about the Python-list mailing list