sqlalchemy tutorialfrom sqlalchemy.sql import alias st=students.alias("a") This alias can now be used in select() construct to refer to students table: s=select([st]).where(st.c.id>2) This translates to SQL expression The complete code is as follows: from sqlalchemy.sql import alias, select st=students.alias("a") s=select([st]).where(st.c.id>2) conn.execute(s).fetchall() When above line of code is executed, students table has the same structure as given in the previous section; whereas the addresses table has st_id column which is mapped to id column in students table using foreign key constraint. The following0 码力 | 92 页 | 1.77 MB | 1 年前3
Python 标准库参考指南 3.6.15 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None (下页继续) 8.1. datetime —基本的日期和时间类型 175 The Python stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: >>> p = Path('setup.py') >>> p.stat().st_mode 33277 >>> p.chmod(0o444) >>> p.stat().st_mode 330600 码力 | 1886 页 | 8.95 MB | 9 月前3
Python 标准库参考指南 3.6.15 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None (下页继续) 8.1. datetime —基本的日期和时间类型 175 The Python stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: >>> p = Path('setup.py') >>> p.stat().st_mode 33277 >>> p.chmod(0o444) >>> p.stat().st_mode 330600 码力 | 1886 页 | 8.95 MB | 9 月前3
Python 标准库参考指南 3.7.13 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: >>> p = Path('setup.py') >>> p.stat().st_mode 33277 >>> p.chmod(0o444) >>> p.stat().st_mode 330600 码力 | 1846 页 | 9.09 MB | 9 月前3
Python 标准库参考指南 3.7.13 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() 对象,其中包含有关此路径的信息,例如os.stat()。结果会在每次调 用此方法时重新搜索。 >>> p = Path('setup.py') >>> p.stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: 11.1. pathlib ---0 码力 | 1961 页 | 9.14 MB | 9 月前3
Python 标准库参考指南 2.7.18 these as arguments to the diff function fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) (下页继续) 112 Chapter 7. String Services The Python Library Reference 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() regular file''' for f in os.listdir(top): pathname = os.path.join(top, f) mode = os.stat(pathname).st_mode if S_ISDIR(mode): # It's a directory, recurse into it walktree(pathname, callback) elif S_ISREG(mode):0 码力 | 1552 页 | 7.42 MB | 9 月前3
Python 标准库参考指南 2.7.18 these as arguments to the diff function fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) (下页继续) 112 Chapter 7. String Services The Python Library Reference 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() regular file''' for f in os.listdir(top): pathname = os.path.join(top, f) mode = os.stat(pathname).st_mode if S_ISDIR(mode): # It's a directory, recurse into it walktree(pathname, callback) elif S_ISREG(mode):0 码力 | 1552 页 | 7.42 MB | 9 月前3
Python 标准库参考指南 2.7.18 these as arguments to the diff function fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) (下页继续) 112 Chapter 7. String Services The Python Library Reference 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() regular file''' for f in os.listdir(top): pathname = os.path.join(top, f) mode = os.stat(pathname).st_mode if S_ISDIR(mode): # It's a directory, recurse into it walktree(pathname, callback) elif S_ISREG(mode):0 码力 | 1552 页 | 7.42 MB | 9 月前3
Python 标准库参考指南 3.8.20 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() 对象,其中包含有关此路径的信息,例如os.stat()。结果会在每次 调用此方法时重新搜索。 >>> p = Path('setup.py') >>> p.stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: 352 Chapter 11.0 码力 | 1927 页 | 9.69 MB | 9 月前3
Python 标准库参考指南 3.8.20 datetime import datetime, timezone def file_mtime(path): t = datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc) return t.astimezone().isoformat() def main(): parser = argparse.ArgumentParser() 21 # day 16 # hour 30 # minute 0 # second 1 # weekday (0 = Monday) 325 # number of days since 1st January -1 # dst - method tzinfo.dst() returned None >>> # Date in ISO format >>> ic = dt.isocalendar() 对象,其中包含有关此路径的信息,例如os.stat()。结果会在每次 调用此方法时重新搜索。 >>> p = Path('setup.py') >>> p.stat().st_size 956 >>> p.stat().st_mtime 1327883547.852554 Path.chmod(mode) 改变文件的模式和权限,和os.chmod() 一样: 352 Chapter 11.0 码力 | 1927 页 | 9.69 MB | 9 月前3
共 188 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19













