[英]How do I successfully import something from a module which has the same name as a reserved function or keyword in Python?
in Python, I am trying to import the open
function object from the built-in os
module, but it would not let me import it as it has the same name as the built-in open
function, which is used for opening files. 如何從與保留的內置函數/關鍵字同名的模塊中導入對象/屬性?
喜歡
from os import open
您可以使用as
別名。
from os import open as osopen
您可以通過as
作為另一個名稱導入
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.