學習python中遇到的問題(1)

  • 2020 年 1 月 14 日
  • 筆記

1、CREATE TABLE todo (   id serial primary key,   title text,   created timestamp default now(),   done boolean default 'f'    );

在mysql5.1.47 中出錯,提示done錯誤的defalt值 搜索後找到一段這樣的資料 The default value for the boolean type property may be set to to 'true' or 'false'. It needs to be translated to 1 or 0 before it is sent to be set in the database. An FDO boolean is mapped into MySQL tinyint. 把'f'改為0就成功了

2、連接mysql的問題 安裝MySQL-python-1.2.2.win32-py2.6這個版本,少不少事 運行後出現報錯;出現File "C:Python26libsite-packagesMySQLdb__init__.py", line 19, in <module> 是缺少2個dll文件分別為 libguide40.dll和libmmd.dll

3.pythonpath的問題 在環境變數里的用戶變數里設置pythonpath,可以的idle中import新增目錄中的模組,但是不能直接訪問該目錄中文件