一个显示当前日期时间的简单网页代码
#!/usr/bin/env python3
import os
date = os.popen("date").read()
html = f"""
<html>
<body>
<p style='color:#ff0000'>
{date}
</p>
</body>
</html>
"""
print(html)
解释一下里面的语法:
第1行是Shell脚本的声明,告诉操作系统应该在哪里找执行这个脚本的命令:
#!/usr/bin/env python3
下面两句是调用系统命令并获取结果。我们可以在Linux的Shell里运行date命令也看到这个结果。date还可以替换成别的Linux命令。特别注意不要把未经过滤的用户输入字符串作为系统命令运行,这会让系统被轻易地入侵。
如果下面命令报错:
pip3 install turtle
请下载附件,然后运行:
tar zxvf turtle-0.0.2-fixed.tar.gz
pip3 install -e turtle-0.0.2
然而,安装是成功了,但是Mac上运行没有什么效果。Android上的QPython上运行则什么属性都没有。因此,想在Android上用turtle,应该直接安装Pydroid 3,它内置了tutle库。
edit /etc/environment or ~/.bashrc
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
Logout and login
Reference: https://github.com/fcitx/fcitx5/issues/595
如果硬盘顺序出问题,进入了grub命令行模式,可以通过下面命令Grub启动系统:
ls -l # 查root参数
set root='hd1,msdos2'
linux /boot/vmlinuz root=/dev/sdb2
initrd /boot/initrd.img
boot
启动系统后修改/boot/grub/grub.cfg,然后运行
sudo grub-install
在硬盘位置固定前不要运行update-grub,它会重新生成grub.cfg,把之前的修改覆盖。但在引导硬盘被移除后,系统重启如果进入了紧急维护模式,则需要重新运行update-grub来更正参数里的硬盘位置值。(不过好像更正了硬盘配置位置还是会进入紧急维护模式,不知道哪里还有问题怎么修复)
如果移动硬盘无法启动,可以尝试在另外一台Linux里启动,然后运行:
LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.
How to use system font in WebView of Android?
https://8v6.cn/ 一个集成ChatGPT、文心一言等的网站。在广告上看到的,要注册才能用,不知道靠不谱靠谱。先记录一下,将来也许用得着。
热门内容
最新内容
- 1 day 10 hours ago
- 1 month 2 weeks ago
- 1 month 2 weeks ago
- 1 month 3 weeks ago
- 1 month 4 weeks ago
- 1 month 4 weeks ago
- 1 month 4 weeks ago
- 1 month 4 weeks ago
- 1 month 4 weeks ago
- 2 months ago
最新评论