當前位置: 首頁>>代碼示例>>Python>>正文


Python sqlite3.html方法代碼示例

本文整理匯總了Python中sqlite3.html方法的典型用法代碼示例。如果您正苦於以下問題:Python sqlite3.html方法的具體用法?Python sqlite3.html怎麽用?Python sqlite3.html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlite3的用法示例。


在下文中一共展示了sqlite3.html方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _instrument

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def _instrument(self, **kwargs):
        """Integrate with SQLite3 Python library.
        https://docs.python.org/3/library/sqlite3.html
        """
        tracer_provider = kwargs.get("tracer_provider")

        tracer = get_tracer(__name__, __version__, tracer_provider)

        dbapi.wrap_connect(
            tracer,
            sqlite3,
            "connect",
            self._DATABASE_COMPONENT,
            self._DATABASE_TYPE,
            self._CONNECTION_ATTRIBUTES,
        ) 
開發者ID:open-telemetry,項目名稱:opentelemetry-python,代碼行數:18,代碼來源:__init__.py

示例2: adapt_datetime

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def adapt_datetime(ts):
    # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
    return time.mktime(ts.timetuple()) 
開發者ID:primaeval,項目名稱:script.tvguide.fullscreen,代碼行數:5,代碼來源:playwithchannel.py

示例3: adapt_datetime

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def adapt_datetime(ts):
        # http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable
        return time.mktime(ts.timetuple()) 
開發者ID:primaeval,項目名稱:script.tvguide.fullscreen,代碼行數:5,代碼來源:source.py

示例4: get_url

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def get_url(self,url):
        #headers = {'user-agent': 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+'}
        headers = {'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'}
        try:
            r = requests.get(url,headers=headers)
            html = HTMLParser.HTMLParser().unescape(r.content.decode('utf-8'))
            return html
        except:
            return '' 
開發者ID:primaeval,項目名稱:script.tvguide.fullscreen,代碼行數:11,代碼來源:source.py

示例5: generate_insert_sqlstr_multivalue_tuple

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def generate_insert_sqlstr_multivalue_tuple(table_name, column_name_list, column_value_lists):
    # Formulate the sql string and value tuple for batch sql insert queries
    # The key point is to use executemany function
    # https://docs.python.org/2/library/sqlite3.html
    sqlstr = 'INSERT INTO %s( %s ) VALUES ( %s )' % (table_name, ','.join(column_name_list),
                                                     ','.join(['?'] * len(column_name_list)))
    return (sqlstr, column_value_lists) 
開發者ID:osssanitizer,項目名稱:osspolice,代碼行數:9,代碼來源:sqlite_util.py

示例6: GetValues

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def GetValues(self, table_names, column_names, condition):
    """Retrieves values from a table.

    Args:
      table_names (list[str]): table names.
      column_names (list[str]): column names.
      condition (str): query condition such as
          "log_source == 'Application Error'".

    Yields:
      sqlite3.row: row.

    Raises:
      RuntimeError: if the database is not opened.
    """
    if not self._connection:
      raise RuntimeError('Cannot retrieve values database not opened.')

    if condition:
      condition = ' WHERE {0:s}'.format(condition)

    sql_query = 'SELECT {1:s} FROM {0:s}{2:s}'.format(
        ', '.join(table_names), ', '.join(column_names), condition)

    self._cursor.execute(sql_query)

    # TODO: have a look at https://docs.python.org/2/library/
    # sqlite3.html#sqlite3.Row.
    for row in self._cursor:
      yield {
          column_name: row[column_index]
          for column_index, column_name in enumerate(column_names)} 
開發者ID:log2timeline,項目名稱:plaso,代碼行數:34,代碼來源:winevt_rc.py

示例7: __init__

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def __init__(self, *args, **kwargs):
        # by default [py]sqlite3 checks that object methods are run in the same
        # thread as the one that created the Connection or Cursor. If it finds
        # they are not then an exception is raised.
        # <https://docs.python.org/2/library/sqlite3.html#multithreading>
        # Luckily for us we can switch this check off.
        kwargs['check_same_thread'] = False
        super(Connection, self).__init__(*args, **kwargs) 
開發者ID:OpenSight,項目名稱:janus-cloud,代碼行數:10,代碼來源:gsqlite3.py

示例8: __init__

# 需要導入模塊: import sqlite3 [as 別名]
# 或者: from sqlite3 import html [as 別名]
def __init__(self, databaseFilePath):
        print("Intializing database at {}".format(databaseFilePath))

        self.dbConnection = sqlite3.connect(databaseFilePath)

        # This gives us the ability to access results by column name
        # See https://docs.python.org/3/library/sqlite3.html#row-objects
        self.dbConnection.row_factory = sqlite3.Row

        self.initializeDatabaseTables() 
開發者ID:makuto,項目名稱:Liked-Saved-Image-Downloader,代碼行數:12,代碼來源:LikedSavedDatabase.py


注:本文中的sqlite3.html方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。