Python多线程编程,线程锁
多线程
-
什么是线程?
- 线程也是一种多任务的编程方法,可以利用计算机多核资源完成程序的并发运行。
- 线程又被称为轻量级进程
-
线程的特征
- 线程是计算机多核分配的最小单位
- 一个进程可以包含多个线程
- 线程也是一个运行的过程,消耗计算机资源,多个线程共享进程的资源和空间
- 线程的创建删除消耗的资源都远远比进程小
- 多个线程之间执行互不干扰
- 线程也有自己的特有属性,比如指令集ID
threading 模块创建线程
-
t=threading.Thread()
-
功能:创建线程对象
-
参数
- name:线程名称,如果为空则为默认值,Tread-1,Tread-2,Tread-3
- target:线程函数
- args:元组,给线程函数按照位置传参
- kwargs:字典,给县城函数按照键值传参
-
-
t.start()
:启动线程,自动运行线程函数 -
t.join([timeout])
:回收进程 -
t.is_alive()
:查看线程状态 -
t.name()
:查看线程名称 -
t.setName()
:设置线程名称 -
t.daemon属性
:默认主线成退出不影响分支线程继续执行,如果设置为True则分支线程随着主线程一起退出-
设置方法
-
t.daemon = True
-
t.setDaemon(Ture)
-
-
-
1 #!/usr/bin/env python3 2 from threading import Thread 3 from time import sleep 4 import os 5 6 # 创建线程函数 7 def music(): 8 sleep(2) 9 print("分支线程") 10 11 t = Thread(target = music) 12 # t.start() # ****************************** 13 print("主线程结束---------") 14 15 '''没有设置的打印结果 16 主线程结束--------- 17 分支线程 18 ''' 19 20 '''设置为True打印结果 21 主线程结束--------- 22 '''
-
threading.currentThread
:获取当前线程对象
@此处代码示意子线程共享同一个进程内的变量
1 #!/usr/bin/env python3 2 from threading import Thread 3 from time import sleep 4 import os 5 6 # 创建线程函数 7 def music(): 8 global a 9 print("a=",a) 10 a = 10000 11 for i in range(5): 12 sleep(1) 13 print("1212") 14 15 a = 1 16 t = Thread(target = music) 17 t.start() 18 t.join() 19 print("主线程的a =",a)
创建自己的线程类
考察点:类的使用,调用父类的__init__
方法,函数*传参和**传参
1 2 3 from threading import Thread 4 import time 5 6 class MyThread(Thread): 7 name1 = 'MyThread-1' 8 def __init__(self,target,args=(), kwargs={}, name = 'MyThread-1'): 9 super().__init__() 10 self.name = name 11 self.target = target 12 self.args = args 13 self.kwargs = kwargs 14 def run(self): 15 self.target(*self.args,**self.kwargs) 16 17 def player(song,sec): 18 for i in range(2): 19 print("播放 %s:%s"%(song,time.ctime())) 20 time.sleep(sec) 21 22 t =MyThread(target = player, args = ('亮亮',2)) 23 24 t.start() 25 t.join() 26
线程通信
通信方法:由于多个线程共享进程的内存空间,所以线程间通信可以使用全局变量完成
注意事项:线程间使用全局变量往往要同步互斥机制保证通信的安全
线程同步互斥方法
-
event
-
e = threading.Event()
:创建事件对象 -
e.wait([timeout])
:设置状态,如果已经设置,那么这个函数将阻塞,timeout为超时时间 -
e.set
:将e变成设置状态 -
e.clear
:删除设置状态
import threading from time import sleep def fun1(): print("bar拜山头") global s s = "天王盖地虎" def fun2(): sleep(4) global s print("我把限制解除了") e.set() # 解除限制,释放资源 def fun3(): e.wait() # 检测限制 print("说出口令") global s if s == "天王盖地虎": print("宝塔镇河妖,自己人") else: print("打死他") s = "哈哈哈哈哈哈" # 创建同步互斥对象 e = threading.Event() # 创建新线程 f1 = threading.Thread(target = fun1) f3 = threading.Thread(target = fun3) f2 = threading.Thread(target = fun2) # 开启线程 f1.start() f3.start() f2.start() #准备回收 f1.join() f3.join() f2.join()
线程锁
-
lock = threading.Lock()
:创建锁对象 -
lock.acquire()
:上锁 -
lock.release()
:解锁
也可以用过with
来上锁
1 with lock: 2 ... 3 ...
@需要了解!!!
-
Python线程的GIL问题(全局解释器):
python—->支持多线程—->同步互斥问题—->加锁解决—->超级锁(给解释器加锁)—->解释器同一时刻只能解释一个线程—>导致效率低下
-
后果:
一个解释器同一时刻只能解释执行一个线程,所以导致Python线程效率低下,但是当遇到IO阻塞时线程会主动让出解释器,因此Pyhton线程更加适合高延迟的IO程序并发
-
解决方案
- 尽量使用进程完成并发(和没说一样)
- 不适当用C解释器 (用C# ,JAVA)
- 尽量使用多种方案组合的方式进行并发操作,线程用作高延迟IO
html { }
:root { }
html { font-size: 14px; background-color: var(–bg-color); color: var(–text-color); font-family: “Helvetica Neue”, Helvetica, Arial, sans-serif }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; background: inherit }
iframe { margin: auto }
a.url { }
a:active,a:hover { outline: 0px }
.in-text-selection,::selection { background: var(–select-text-bg-color); color: var(–select-text-font-color) }
#write { margin: 0px auto; height: auto; width: inherit; position: relative; white-space: normal; padding-bottom: 70px }
.first-line-indent #write div,.first-line-indent #write li,.first-line-indent #write p { text-indent: 2em }
.first-line-indent #write div :not(p):not(div),.first-line-indent #write div.md-htmlblock-container,.first-line-indent #write p *,.first-line-indent pre { text-indent: 0px }
.for-image #write { padding-left: 8px; padding-right: 8px }
body.typora-export { padding-left: 30px; padding-right: 30px }
#write>blockquote:first-child,#write>div:first-child,#write>figure:first-child,#write>ol:first-child,#write>p:first-child,#write>pre:first-child,#write>ul:first-child { margin-top: 30px }
#write li>figure:first-child { margin-top: -20px }
#write ol,#write ul { position: relative }
img { max-width: 100%; vertical-align: middle }
button,input,select,textarea { color: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-family: inherit }
input[type=”checkbox”],input[type=”radio”] { line-height: normal; padding: 0px }
*,::after,::before { }
#write h1,#write h2,#write h3,#write h4,#write h5,#write h6,#write p,#write pre { width: inherit }
#write h1,#write h2,#write h3,#write h4,#write h5,#write h6,#write p { position: relative }
h1,h2,h3,h4,h5,h6 { orphans: 2 }
p { orphans: 4 }
h1 { font-size: 2rem }
h2 { font-size: 1.8rem }
h3 { font-size: 1.6rem }
h4 { font-size: 1.4rem }
h5 { font-size: 1.2rem }
h6 { font-size: 1rem }
.md-math-block,.md-rawblock,h1,h2,h3,h4,h5,h6,p { margin-top: 1rem; margin-bottom: 1rem }
.hidden { display: none }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic }
a { cursor: pointer }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); cursor: pointer }
sup.md-footnote a,sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit }
#write input[type=”checkbox”] { cursor: pointer; width: inherit; height: inherit }
figure { margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px }
figure>table { margin: 0px !important }
tr { }
thead { display: table-header-group }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; text-align: left }
table.md-table td { min-width: 80px }
.CodeMirror-gutters { border-right: 0px; background-color: inherit }
.CodeMirror { text-align: left }
.CodeMirror-placeholder { opacity: 0.3 }
.CodeMirror pre { padding: 0px 4px }
.CodeMirror-lines { padding: 0px }
div.hr:focus { cursor: none }
#write pre { white-space: pre-wrap }
#write.fences-no-line-wrapping pre { white-space: pre }
#write pre.ty-contain-cm { white-space: normal }
.CodeMirror-gutters { margin-right: 4px }
.md-fences { font-size: 0.9rem; display: block; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px }
#write .md-fences.mock-cm { white-space: pre-wrap }
.md-fences.md-fences-with-lineno { padding-left: 0px }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px }
.CodeMirror-line,twitterwidget { }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em }
.footnotes+.footnotes { margin-top: 0px }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; line-height: normal; font-weight: 400; text-align: left; direction: ltr }
li div { padding-top: 0px }
blockquote { margin: 1rem 0px }
li .mathjax-block,li p { margin: 0.5rem 0px }
li { margin: 0px; position: relative }
blockquote>:last-child { margin-bottom: 0px }
blockquote>:first-child,li>:first-child { margin-top: 0px }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal }
#write .footnote-line { white-space: pre-wrap }
.footnote-line { margin-top: 0.714em; font-size: 0.7em }
a img,img a { cursor: pointer }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block }
p>img:only-child { display: block; margin: auto }
p>.md-image:only-child { display: inline-block; width: 100%; text-align: center }
#write .MathJax_Display { margin: 0.8em 0px 0px }
.md-math-block { width: 100% }
.md-math-block:not(:empty)::after { display: none }
[contenteditable=”true”]:active,[contenteditable=”true”]:focus { outline: 0px }
.md-task-list-item { position: relative; list-style-type: none }
.task-list-item.md-task-list-item { padding-left: 0px }
.md-task-list-item>input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em – 10px) }
.math { font-size: 1rem }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem }
.md-toc-content { position: relative; margin-left: 0px }
.md-toc-content::after,.md-toc::after { display: none }
.md-toc-item { display: block; color: rgb(65, 131, 196) }
.md-toc-item a { text-decoration: none }
.md-toc-inner:hover { }
.md-toc-inner { display: inline-block; cursor: pointer }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700 }
.md-toc-h2 .md-toc-inner { margin-left: 2em }
.md-toc-h3 .md-toc-inner { margin-left: 4em }
.md-toc-h4 .md-toc-inner { margin-left: 6em }
.md-toc-h5 .md-toc-inner { margin-left: 8em }
.md-toc-h6 .md-toc-inner { margin-left: 10em }
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit }
.footnote-line a:not(.reversefootnote) { color: inherit }
.md-attr { display: none }
.md-fn-count::after { content: “.” }
code,pre,samp,tt { font-family: var(–monospace) }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); white-space: nowrap; vertical-align: middle }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(–monospace) }
code { text-align: left; vertical-align: initial }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important }
.md-inline-math .MathJax_SVG .noError { display: none !important }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; display: block !important }
.MathJax_SVG_Display,.md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important }
.MathJax_SVG .MJX-monospace { font-family: var(–monospace) }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px }
.MathJax_SVG * { }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important }
.os-windows.monocolor-emoji .md-emoji { font-family: “Segoe UI Symbol”, sans-serif }
.md-diagram-panel>svg { max-width: 100% }
[lang=”mermaid”] svg,[lang=”flow”] svg { max-width: 100% }
[lang=”mermaid”] .node text { font-size: 1rem }
table tr th { border-bottom: 0px }
video { max-width: 100%; display: block; margin: 0px auto }
iframe { max-width: 100%; width: 100%; border: none }
.highlight td,.highlight tr { border: 0px }
.CodeMirror { height: auto }
.CodeMirror.cm-s-inner { background: inherit }
.CodeMirror-scroll { z-index: 3 }
.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255) }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153) }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136) }
.cm-s-inner .cm-atom,.cm-s-inner.cm-atom { color: rgb(34, 17, 153) }
.cm-s-inner .cm-number { color: rgb(17, 102, 68) }
.cm-s-inner .cm-def { color: rgb(0, 0, 255) }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0) }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170) }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85) }
.cm-s-inner .cm-string { color: rgb(170, 17, 17) }
.cm-s-inner .cm-property { color: rgb(0, 0, 0) }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26) }
.cm-s-inner .cm-comment,.cm-s-inner.cm-comment { color: rgb(170, 85, 0) }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0) }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85) }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85) }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170) }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119) }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0) }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204) }
.cm-s-inner .cm-header,.cm-s-inner.cm-header { color: rgb(0, 0, 255) }
.cm-s-inner .cm-quote,.cm-s-inner.cm-quote { color: rgb(0, 153, 0) }
.cm-s-inner .cm-hr,.cm-s-inner.cm-hr { color: rgb(153, 153, 153) }
.cm-s-inner .cm-link,.cm-s-inner.cm-link { color: rgb(0, 0, 204) }
.cm-negative { color: rgb(221, 68, 68) }
.cm-positive { color: rgb(34, 153, 34) }
.cm-header,.cm-strong { font-weight: 700 }
.cm-del { text-decoration: line-through }
.cm-em { font-style: italic }
.cm-link { text-decoration: underline }
.cm-error { color: red }
.cm-invalidchar { color: red }
.cm-constant { color: rgb(38, 139, 210) }
.cm-defined { color: rgb(181, 137, 0) }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0) }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34) }
.cm-s-inner .CodeMirror-activeline-background { background: inherit }
.CodeMirror { position: relative; overflow: hidden }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; background: inherit }
.CodeMirror-sizer { position: relative }
.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3 }
.CodeMirror-gutter { white-space: normal; height: 100%; padding-bottom: 30px; margin-bottom: -32px; display: inline-block }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4 }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4 }
.CodeMirror-lines { cursor: text }
.CodeMirror pre { border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; color: inherit; z-index: 2; position: relative; overflow: visible }
.CodeMirror-wrap pre { white-space: pre-wrap }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0 }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto }
.CodeMirror-wrap .CodeMirror-scroll { }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden }
.CodeMirror-measure pre { position: static }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px }
.CodeMirror div.CodeMirror-cursor { visibility: hidden }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit }
.cm-searching { background: rgba(255, 255, 0, 0.4) }
:root { }
html { font-size: 16px }
body { font-family: “Open Sans”, “Clear Sans”, “Helvetica Neue”, Helvetica, Arial, sans-serif; color: rgb(51, 51, 51); line-height: 1.6 }
#write { max-width: 860px; margin: 0px auto; padding: 20px 30px 100px }
#write>ul:first-child,#write>ol:first-child { margin-top: 30px }
body>:first-child { margin-top: 0px !important }
body>:last-child { margin-bottom: 0px !important }
a { color: rgb(65, 131, 196) }
h1,h2,h3,h4,h5,h6 { position: relative; margin-top: 1rem; margin-bottom: 1rem; font-weight: bold; line-height: 1.4; cursor: text }
h1:hover a.anchor,h2:hover a.anchor,h3:hover a.anchor,h4:hover a.anchor,h5:hover a.anchor,h6:hover a.anchor { text-decoration: none }
h1 tt,h1 code { font-size: inherit }
h2 tt,h2 code { font-size: inherit }
h3 tt,h3 code { font-size: inherit }
h4 tt,h4 code { font-size: inherit }
h5 tt,h5 code { font-size: inherit }
h6 tt,h6 code { font-size: inherit }
h1 { padding-bottom: 0.3em; font-size: 2.25em; line-height: 1.2; border-bottom: 1px solid rgb(238, 238, 238) }
h2 { padding-bottom: 0.3em; font-size: 1.75em; line-height: 1.225; border-bottom: 1px solid rgb(238, 238, 238) }
h3 { font-size: 1.5em; line-height: 1.43 }
h4 { font-size: 1.25em }
h5 { font-size: 1em }
h6 { font-size: 1em; color: rgb(119, 119, 119) }
p,blockquote,ul,ol,dl,table { margin: 0.8em 0px }
li>ol,li>ul { margin: 0px }
hr { height: 2px; padding: 0px; margin: 16px 0px; background-color: rgb(231, 231, 231); border: 0px none; overflow: hidden }
body>h2:first-child { margin-top: 0px; padding-top: 0px }
body>h1:first-child { margin-top: 0px; padding-top: 0px }
body>h1:first-child+h2 { margin-top: 0px; padding-top: 0px }
body>h3:first-child,body>h4:first-child,body>h5:first-child,body>h6:first-child { margin-top: 0px; padding-top: 0px }
a:first-child h1,a:first-child h2,a:first-child h3,a:first-child h4,a:first-child h5,a:first-child h6 { margin-top: 0px; padding-top: 0px }
h1 p,h2 p,h3 p,h4 p,h5 p,h6 p { margin-top: 0px }
li p.first { display: inline-block }
ul,ol { padding-left: 30px }
ul:first-child,ol:first-child { margin-top: 0px }
ul:last-child,ol:last-child { margin-bottom: 0px }
blockquote { border-left: 4px solid rgb(223, 226, 229); padding: 0px 15px; color: rgb(119, 119, 119) }
blockquote blockquote { padding-right: 0px }
table { padding: 0px }
table tr { border-top: 1px solid rgb(223, 226, 229); margin: 0px; padding: 0px }
table tr:nth-child(2n),thead { background-color: rgb(248, 248, 248) }
table tr th { font-weight: bold; border-width: 1px 1px 0px; border-top-style: solid; border-right-style: solid; border-left-style: solid; border-top-color: rgb(223, 226, 229); border-right-color: rgb(223, 226, 229); border-left-color: rgb(223, 226, 229); border-bottom-style: initial; border-bottom-color: initial; text-align: left; margin: 0px; padding: 6px 13px }
table tr td { border: 1px solid rgb(223, 226, 229); text-align: left; margin: 0px; padding: 6px 13px }
table tr th:first-child,table tr td:first-child { margin-top: 0px }
table tr th:last-child,table tr td:last-child { margin-bottom: 0px }
.CodeMirror-lines { padding-left: 4px }
.code-tooltip { border-top: 1px solid rgb(238, 242, 242) }
.md-fences,code,tt { border: 1px solid rgb(231, 234, 237); background-color: rgb(248, 248, 248); padding: 2px 4px 0px; font-size: 0.9em }
code { background-color: rgb(243, 244, 244); padding: 0px 4px 2px }
.md-fences { margin-bottom: 15px; margin-top: 15px; padding: 8px 1em 6px }
.md-task-list-item>input { margin-left: -1.3em }
.md-fences { background-color: rgb(248, 248, 248) }
#write pre.md-meta-block { padding: 1rem; font-size: 85%; line-height: 1.45; background-color: rgb(247, 247, 247); border: 0px; color: rgb(119, 119, 119); margin-top: 0px !important }
.mathjax-block>.code-tooltip { bottom: 0.375rem }
.md-mathjax-midline { background: rgb(250, 250, 250) }
#write>h3.md-focus::before { left: -1.5625rem; top: 0.375rem }
#write>h4.md-focus::before { left: -1.5625rem; top: 0.285714rem }
#write>h5.md-focus::before { left: -1.5625rem; top: 0.285714rem }
#write>h6.md-focus::before { left: -1.5625rem; top: 0.285714rem }
.md-image>.md-meta { padding: 2px 0px 0px 4px; font-size: 0.9em; color: inherit }
.md-tag { color: rgb(167, 167, 167); opacity: 1 }
.md-toc { margin-top: 20px; padding-bottom: 20px }
.sidebar-tabs { border-bottom: none }
#typora-quick-open { border: 1px solid rgb(221, 221, 221); background-color: rgb(248, 248, 248) }
#typora-quick-open-item { background-color: rgb(250, 250, 250); border-color: rgb(254, 254, 254) rgb(229, 229, 229) rgb(229, 229, 229) rgb(238, 238, 238); border-style: solid; border-width: 1px }
.on-focus-mode blockquote { border-left-color: rgba(85, 85, 85, 0.12) }
header,.context-menu,.megamenu-content,footer { font-family: “Segoe UI”, Arial, sans-serif }
.file-node-content:hover .file-node-icon,.file-node-content:hover .file-node-open-state { visibility: visible }
.mac-seamless-mode #typora-sidebar { background-color: var(–side-bar-bg-color) }
.md-lang { color: rgb(180, 101, 77) }
.html-for-mac .context-menu { }
.typora-export p,.typora-export .footnote-line { white-space: normal }
#MySignature { display: none; background-color: rgba(178,232,102,0.65); padding: 10px; line-height: 1.5; font-size: 16px; font-family: “Microsoft Yahei” }