首页 > 代码库 > python笔记

python笔记

pip install -r requirements.txt
pip freeze > requirements.txt
<style>code { color: #c7254e; background-color: #f9f2f4 } code,kbd { padding: 2px 4px } kbd { color: #fff; background-color: #333 } kbd kbd { padding: 0; font-size: 100% } pre { display: block; margin: 0 0 10px; color: #333; background-color: #f5f5f5; border: 1px solid #ccc } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent } .pre-scrollable { max-height: 340px } table { background-color: transparent } th { text-align: left } .table { width: 100%; max-width: 100%; margin-bottom: 20px } .table>thead>tr>th { padding: 8px; line-height: 1.4285714; border-top: 1px solid #ddd } .table>thead>tr>td,.table>tbody>tr>th,.table>tbody>tr>td,.table>tfoot>tr>th,.table>tfoot>tr>td { padding: 8px; line-height: 1.4285714; vertical-align: top; border-top: 1px solid #ddd } .table>thead>tr>th { vertical-align: bottom; border-bottom: 2px solid #ddd } .table>caption+thead>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>th,.table>thead:first-child>tr:first-child>td { border-top: 0 } .table>tbody+tbody { border-top: 2px solid #ddd } .table .table { background-color: #fff } .table-condensed>thead>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>tfoot>tr>td { padding: 5px } .table-bordered,.table-bordered>thead>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>tfoot>tr>td { border: 1px solid #ddd } .table-bordered>thead>tr>th,.table-bordered>thead>tr>td { border-bottom-width: 2px } .table-striped>tbody>tr:nth-child(2n+1)>td,.table-striped>tbody>tr:nth-child(2n+1)>th { background-color: #f9f9f9 } .table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th { background-color: #f5f5f5 } table col[class*="col-"] { position: static; float: none; display: table-column } table td[class*="col-"],table th[class*="col-"] { position: static; float: none; display: table-cell } .table>thead>tr>td.active,.table>thead>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th { background-color: #f5f5f5 } .table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th { background-color: #e8e8e8 } .table>thead>tr>td.success,.table>thead>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th { background-color: #dff0d8 } .table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th { background-color: #d0e9c6 } .table>thead>tr>td.info,.table>thead>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th { background-color: #d9edf7 } .table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th { background-color: #c4e3f3 } .table>thead>tr>td.warning,.table>thead>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th { background-color: #fcf8e3 } .table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th { background-color: #faf2cc } .table>thead>tr>td.danger,.table>thead>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th { background-color: #f2dede } .table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th { background-color: #ebcccc } fieldset { border: 0; min-width: 0 } legend { display: block; width: 100%; margin-bottom: 20px; font-size: 21px; line-height: inherit; color: #333; border-bottom: 1px solid #e5e5e5 } label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: 700 } input[type="radio"],input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px ; line-height: normal } input[type="file"] { display: block } input[type="range"] { display: block; width: 100% } select[multiple],select[size] { height: auto } input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus { outline: 5px auto -webkit-focus-ring-color } output { padding-top: 7px } output,.form-control { display: block; font-size: 14px; line-height: 1.4285714; color: #555 } .form-control { width: 100%; height: 34px; padding: 6px 12px; background-color: #fff; background-image: none; border: 1px solid #ccc } .form-control:focus { border-color: #66afe9; outline: 0 } .form-control::-moz-placeholder { color: #777; opacity: 1 } .form-control:-ms-input-placeholder { color: #777 } .form-control::-webkit-input-placeholder { color: #777 } .form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control { cursor: not-allowed; background-color: #eee; opacity: 1 } textarea.form-control { height: auto } input[type="date"],input[type="time"],input[type="datetime-local"],input[type="month"] { line-height: 1.4285714 ? } input[type="date"].input-sm,.form-horizontal .form-group-sm input[type="date"].form-control,.input-group-sm>input[type="date"].form-control,.input-group-sm>input[type="date"].input-group-addon,.input-group-sm>.input-group-btn>input[type="date"].btn,input[type="time"].input-sm,.form-horizontal .form-group-sm input[type="time"].form-control,.input-group-sm>input[type="time"].form-control,.input-group-sm>input[type="time"].input-group-addon,.input-group-sm>.input-group-btn>input[type="time"].btn,input[type="datetime-local"].input-sm,.form-horizontal .form-group-sm input[type="datetime-local"].form-control,.input-group-sm>input[type="datetime-local"].form-control,.input-group-sm>input[type="datetime-local"].input-group-addon,.input-group-sm>.input-group-btn>input[type="datetime-local"].btn,input[type="month"].input-sm,.form-horizontal .form-group-sm input[type="month"].form-control,.input-group-sm>input[type="month"].form-control,.input-group-sm>input[type="month"].input-group-addon,.input-group-sm>.input-group-btn>input[type="month"].btn { line-height: 30px } input[type="date"].input-lg,.form-horizontal .form-group-lg input[type="date"].form-control,.input-group-lg>input[type="date"].form-control,.input-group-lg>input[type="date"].input-group-addon,.input-group-lg>.input-group-btn>input[type="date"].btn,input[type="time"].input-lg,.form-horizontal .form-group-lg input[type="time"].form-control,.input-group-lg>input[type="time"].form-control,.input-group-lg>input[type="time"].input-group-addon,.input-group-lg>.input-group-btn>input[type="time"].btn,input[type="datetime-local"].input-lg,.form-horizontal .form-group-lg input[type="datetime-local"].form-control,.input-group-lg>input[type="datetime-local"].form-control,.input-group-lg>input[type="datetime-local"].input-group-addon,.input-group-lg>.input-group-btn>input[type="datetime-local"].btn,input[type="month"].input-lg,.form-horizontal .form-group-lg input[type="month"].form-control,.input-group-lg>input[type="month"].form-control,.input-group-lg>input[type="month"].input-group-addon,.input-group-lg>.input-group-btn>input[type="month"].btn { line-height: 46px } .form-group { margin-bottom: 15px } .radio,.checkbox { position: relative; display: block; min-height: 20px; margin-top: 10px; margin-bottom: 10px } .radio label,.checkbox label { padding-left: 20px; margin-bottom: 0; font-weight: 400; cursor: pointer } .radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"] { position: absolute; margin-left: -20px; margin-top: 4px } .radio+.radio,.checkbox+.checkbox { margin-top: -5px } .radio-inline,.checkbox-inline { display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: 400; cursor: pointer } .radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline { margin-top: 0; margin-left: 10px } input[type="radio"][disabled],input[type="radio"].disabled,fieldset[disabled] input[type="radio"],input[type="checkbox"][disabled],input[type="checkbox"].disabled,fieldset[disabled] input[type="checkbox"],.radio-inline.disabled,fieldset[disabled] .radio-inline,.checkbox-inline.disabled,fieldset[disabled] .checkbox-inline,.radio.disabled label,fieldset[disabled] .radio label,.checkbox.disabled label,fieldset[disabled] .checkbox label { cursor: not-allowed } .form-control-static { padding-top: 7px; padding-bottom: 7px; margin-bottom: 0 } .form-control-static.input-lg,.form-horizontal .form-group-lg .form-control-static.form-control,.input-group-lg>.form-control-static.form-control,.input-group-lg>.form-control-static.input-group-addon,.input-group-lg>.input-group-btn>.form-control-static.btn,.form-control-static.input-sm,.form-horizontal .form-group-sm .form-control-static.form-control,.input-group-sm>.form-control-static.form-control,.input-group-sm>.form-control-static.input-group-addon,.input-group-sm>.input-group-btn>.form-control-static.btn { padding-left: 0; padding-right: 0 } .input-sm,.form-horizontal .form-group-sm .form-control,.input-group-sm>.form-control { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5 } .input-group-sm>.input-group-addon { height: 30px; line-height: 1.5 } .input-group-sm>.input-group-btn>.btn { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5 } select.input-sm,.form-horizontal .form-group-sm select.form-control,.input-group-sm>select.form-control,.input-group-sm>select.input-group-addon,.input-group-sm>.input-group-btn>select.btn { height: 30px; line-height: 30px } textarea.input-sm,.form-horizontal .form-group-sm textarea.form-control,.input-group-sm>textarea.form-control,.input-group-sm>textarea.input-group-addon,.input-group-sm>.input-group-btn>textarea.btn,select[multiple].input-sm,.form-horizontal .form-group-sm select[multiple].form-control,.input-group-sm>select[multiple].form-control,.input-group-sm>select[multiple].input-group-addon,.input-group-sm>.input-group-btn>select[multiple].btn { height: auto } .input-lg,.form-horizontal .form-group-lg .form-control,.input-group-lg>.form-control { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33 } .input-group-lg>.input-group-addon { height: 46px; line-height: 1.33 } .input-group-lg>.input-group-btn>.btn { height: 46px; padding: 10px 16px; font-size: 18px; line-height: 1.33 } select.input-lg,.form-horizontal .form-group-lg select.form-control,.input-group-lg>select.form-control,.input-group-lg>select.input-group-addon,.input-group-lg>.input-group-btn>select.btn { height: 46px; line-height: 46px } textarea.input-lg,.form-horizontal .form-group-lg textarea.form-control,.input-group-lg>textarea.form-control,.input-group-lg>textarea.input-group-addon,.input-group-lg>.input-group-btn>textarea.btn,select[multiple].input-lg,.form-horizontal .form-group-lg select[multiple].form-control,.input-group-lg>select[multiple].form-control,.input-group-lg>select[multiple].input-group-addon,.input-group-lg>.input-group-btn>select[multiple].btn { height: auto } .has-feedback { position: relative } .has-feedback .form-control { padding-right: 42.5px } .form-control-feedback { position: absolute; top: 25px; right: 0; z-index: 2; display: block; width: 34px; height: 34px; line-height: 34px; text-align: center } .input-lg+.form-control-feedback,.form-horizontal .form-group-lg .form-control+.form-control-feedback,.input-group-lg>.form-control+.form-control-feedback,.input-group-lg>.input-group-addon+.form-control-feedback,.input-group-lg>.input-group-btn>.btn+.form-control-feedback { width: 46px; height: 46px; line-height: 46px } .input-sm+.form-control-feedback,.form-horizontal .form-group-sm .form-control+.form-control-feedback,.input-group-sm>.form-control+.form-control-feedback,.input-group-sm>.input-group-addon+.form-control-feedback,.input-group-sm>.input-group-btn>.btn+.form-control-feedback { width: 30px; height: 30px; line-height: 30px } .has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline { color: #3c763d } .has-success .form-control { border-color: #3c763d } .has-success .form-control:focus { border-color: #2b542c } .has-success .input-group-addon { color: #3c763d; border-color: #3c763d; background-color: #dff0d8 } .has-success .form-control-feedback { color: #3c763d } .has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline { color: #8a6d3b } .has-warning .form-control { border-color: #8a6d3b } .has-warning .form-control:focus { border-color: #66512c } .has-warning .input-group-addon { color: #8a6d3b; border-color: #8a6d3b; background-color: #fcf8e3 } .has-warning .form-control-feedback { color: #8a6d3b } .has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline { color: #a94442 } .has-error .form-control { border-color: #a94442 } .has-error .form-control:focus { border-color: #843534 } .has-error .input-group-addon { color: #a94442; border-color: #a94442; background-color: #f2dede } .has-error .form-control-feedback { color: #a94442 } .has-feedback label.sr-only~.form-control-feedback { top: 0 } .help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: #737373 } .form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline { margin-top: 0; margin-bottom: 0; padding-top: 7px } .form-horizontal .radio,.form-horizontal .checkbox { min-height: 27px } .form-horizontal .form-group { margin-left: -15px; margin-right: -15px } .form-horizontal .form-group::before { content: " "; display: table } .form-horizontal .form-group::after { content: " "; display: table; clear: both } .form-horizontal .has-feedback .form-control-feedback { top: 0; right: 15px } .btn { display: inline-block; vertical-align: middle; cursor: pointer; background-image: none; border: 1px solid transparent; white-space: nowrap } .btn:focus,.btn:active:focus,.btn.active:focus { outline: 5px auto -webkit-focus-ring-color } .btn:hover,.btn:focus { color: #333; text-decoration: none } .btn:active,.btn.active { outline: 0; background-image: none } .btn.disabled,.btn[disabled],fieldset[disabled] .btn { cursor: not-allowed; opacity: .65 } .btn-default { color: #333; background-color: #fff; border-color: #ccc } .btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.btn-default.dropdown-toggle { color: #333; background-color: #e6e6e6; border-color: #adadad } .btn-default:active,.btn-default.active,.open>.btn-default.dropdown-toggle { background-image: none } .btn-default.disabled,.btn-default.disabled:hover,.btn-default.disabled:focus,.btn-default.disabled:active,.btn-default.disabled.active,.btn-default[disabled],.btn-default[disabled]:hover,.btn-default[disabled]:focus,.btn-default[disabled]:active,.btn-default[disabled].active,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default:hover,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default.active { background-color: #fff; border-color: #ccc } .btn-default .badge { color: #fff; background-color: #333 } .btn-primary { color: #fff; background-color: #428bca; border-color: #357ebd } .btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.btn-primary.dropdown-toggle { color: #fff; background-color: #3071a9; border-color: #285e8e } .btn-primary:active,.btn-primary.active,.open>.btn-primary.dropdown-toggle { background-image: none } .btn-primary.disabled,.btn-primary.disabled:hover,.btn-primary.disabled:focus,.btn-primary.disabled:active,.btn-primary.disabled.active,.btn-primary[disabled],.btn-primary[disabled]:hover,.btn-primary[disabled]:focus,.btn-primary[disabled]:active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary:hover,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary.active { background-color: #428bca; border-color: #357ebd } .btn-primary .badge { color: #428bca; background-color: #fff } .btn-success { color: #fff; background-color: #5cb85c; border-color: #4cae4c } .btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.btn-success.dropdown-toggle { color: #fff; background-color: #449d44; border-color: #398439 } .btn-success:active,.btn-success.active,.open>.btn-success.dropdown-toggle { background-image: none } .btn-success.disabled,.btn-success.disabled:hover,.btn-success.disabled:focus,.btn-success.disabled:active,.btn-success.disabled.active,.btn-success[disabled],.btn-success[disabled]:hover,.btn-success[disabled]:focus,.btn-success[disabled]:active,.btn-success[disabled].active,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success:hover,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success.active { background-color: #5cb85c; border-color: #4cae4c } .btn-success .badge { color: #5cb85c; background-color: #fff } .btn-info { color: #fff; background-color: #5bc0de; border-color: #46b8da } .btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.btn-info.dropdown-toggle { color: #fff; background-color: #31b0d5; border-color: #269abc } .btn-info:active,.btn-info.active,.open>.btn-info.dropdown-toggle { background-image: none } .btn-info.disabled,.btn-info.disabled:hover,.btn-info.disabled:focus,.btn-info.disabled:active,.btn-info.disabled.active,.btn-info[disabled],.btn-info[disabled]:hover,.btn-info[disabled]:focus,.btn-info[disabled]:active,.btn-info[disabled].active,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info:hover,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info.active { background-color: #5bc0de; border-color: #46b8da } .btn-info .badge { color: #5bc0de; background-color: #fff } .btn-warning { color: #fff; background-color: #f0ad4e; border-color: #eea236 } .btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.btn-warning.dropdown-toggle { color: #fff; background-color: #ec971f; border-color: #d58512 } .btn-warning:active,.btn-warning.active,.open>.btn-warning.dropdown-toggle { background-image: none } .btn-warning.disabled,.btn-warning.disabled:hover,.btn-warning.disabled:focus,.btn-warning.disabled:active,.btn-warning.disabled.active,.btn-warning[disabled],.btn-warning[disabled]:hover,.btn-warning[disabled]:focus,.btn-warning[disabled]:active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning:hover,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning.active { background-color: #f0ad4e; border-color: #eea236 } .btn-warning .badge { color: #f0ad4e; background-color: #fff } .btn-danger { color: #fff; background-color: #d9534f; border-color: #d43f3a } .btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.btn-danger.dropdown-toggle { color: #fff; background-color: #c9302c; border-color: #ac2925 } .btn-danger:active,.btn-danger.active,.open>.btn-danger.dropdown-toggle { background-image: none } .btn-danger.disabled,.btn-danger.disabled:hover,.btn-danger.disabled:focus,.btn-danger.disabled:active,.btn-danger.disabled.active,.btn-danger[disabled],.btn-danger[disabled]:hover,.btn-danger[disabled]:focus,.btn-danger[disabled]:active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger:hover,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger.active { background-color: #d9534f; border-color: #d43f3a } .btn-danger .badge { color: #d9534f; background-color: #fff } .btn-link { color: #428bca; font-weight: 400; cursor: pointer } .btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link { background-color: transparent } .btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active { border-color: transparent } .btn-link:hover,.btn-link:focus { color: #2a6496; text-decoration: underline; background-color: transparent } .btn-link[disabled]:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:hover,fieldset[disabled] .btn-link:focus { color: #777; text-decoration: none } .btn-lg { padding: 10px 16px; font-size: 18px; line-height: 1.33 } .btn-sm { padding: 5px 10px } .btn-sm,.btn-xs { font-size: 12px; line-height: 1.5 } .btn-xs { padding: 1px 5px } .btn-block { display: block; width: 100% } .btn-block+.btn-block { margin-top: 5px } input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block { width: 100% } .fade { opacity: 0 } .fade.in { opacity: 1 } .collapse { display: none } .collapse.in { display: block } tr.collapse.in { display: table-row } tbody.collapse.in { display: table-row-group } .collapsing { position: relative; height: 0; overflow: hidden } .input-group { position: relative; display: table; border-collapse: separate } .input-group[class*="col-"] { float: none; padding-left: 0; padding-right: 0 } .input-group .form-control { position: relative; z-index: 2; float: left; width: 100%; margin-bottom: 0 } .input-group-addon,.input-group-btn,.input-group .form-control { display: table-cell } .input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child) { } .input-group-addon { white-space: nowrap } .input-group-addon,.input-group-btn { width: 1%; vertical-align: middle } .input-group-addon { padding: 6px 12px; font-size: 14px; font-weight: 400; line-height: 1; color: #555; text-align: center; background-color: #eee; border: 1px solid #ccc } .input-group-addon.input-sm,.form-horizontal .form-group-sm .input-group-addon.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.input-group-addon.btn { padding: 5px 10px; font-size: 12px } .input-group-addon.input-lg,.form-horizontal .form-group-lg .input-group-addon.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.input-group-addon.btn { padding: 10px 16px; font-size: 18px } .input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"] { margin-top: 0 } .input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn { } .input-group-addon:first-child { border-right: 0 } .input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn { } .input-group-addon:last-child { border-left: 0 } .input-group-btn { font-size: 0; white-space: nowrap } .input-group-btn,.input-group-btn>.btn { position: relative } .input-group-btn>.btn+.btn { margin-left: -1px } .input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active { z-index: 2 } .input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group { margin-right: -1px } .input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group { margin-left: -1px } .pagination { display: inline-block; padding-left: 0; margin: 20px 0 } .pagination>li { display: inline } .pagination>li>a,.pagination>li>span { position: relative; float: left; padding: 6px 12px; line-height: 1.4285714; text-decoration: none; color: #428bca; background-color: #fff; border: 1px solid #ddd; margin-left: -1px } .pagination>li:first-child>a,.pagination>li:first-child>span { margin-left: 0 } .pagination>li:last-child>a,.pagination>li:last-child>span { } .pagination>li>a:hover,.pagination>li>a:focus,.pagination>li>span:hover,.pagination>li>span:focus { color: #2a6496; background-color: #eee; border-color: #ddd } .pagination>.active>a,.pagination>.active>a:hover,.pagination>.active>a:focus,.pagination>.active>span,.pagination>.active>span:hover,.pagination>.active>span:focus { z-index: 2; color: #fff; background-color: #428bca; border-color: #428bca; cursor: default } .pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus { color: #777; background-color: #fff; border-color: #ddd; cursor: not-allowed } .pagination-lg>li>a,.pagination-lg>li>span { padding: 10px 16px; font-size: 18px } .pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span { } .pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span { } .pagination-sm>li>a,.pagination-sm>li>span { padding: 5px 10px; font-size: 12px } .pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span { } .pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span { } .close { float: right; font-size: 21px; font-weight: 700; line-height: 1; color: #000; opacity: .2 } .close:hover,.close:focus { color: #000; text-decoration: none; cursor: pointer; opacity: .5 } button.close { padding: 0; cursor: pointer; background: 0 0; border: 0 } .modal-open,.modal { overflow: hidden } .modal { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; outline: 0 } .modal.fade .modal-dialog { } .modal.in .modal-dialog { } .modal-open .modal { } .modal-dialog { position: relative; width: auto; margin: 10px } .modal-content { position: relative; background-color: #fff; border: 1px solid rgba(0,0,0,.2); outline: 0 } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000 } .modal-backdrop.fade { opacity: 0 } .modal-backdrop.in { opacity: .5 } .modal-header { padding: 15px; border-bottom: 1px solid #e5e5e5; min-height: 16.4285714px } .modal-header .close { margin-top: -2px } .modal-title { margin: 0; line-height: 1.4285714 } .modal-body { position: relative; padding: 15px } .modal-footer { padding: 15px; text-align: right; border-top: 1px solid #e5e5e5 } .modal-footer::before,.modal-footer::after { content: " "; display: table } .modal-footer::after { clear: both } .modal-footer .btn+.btn { margin-left: 5px; margin-bottom: 0 } .modal-footer .btn-group .btn+.btn { margin-left: -1px } .modal-footer .btn-block+.btn-block { margin-left: 0 } .modal-scrollbar-measure { position: absolute; top: -9999px; width: 50px; height: 50px; overflow: scroll } .clearfix::before,.clearfix::after { content: " "; display: table } .clearfix::after { clear: both } .center-block { display: block; margin-left: auto; margin-right: auto } .pull-right { float: right !important } .pull-left { float: left !important } .hide { display: none !important } .show { display: block !important } .invisible { visibility: hidden } .text-hide { font: 0/0 a; color: transparent; background-color: transparent; border: 0 } .hidden { display: none !important; visibility: hidden !important } .affix { position: fixed } .hljs { display: block; padding: .5em; background: #002b36; color: #839496 } .hljs-comment,.hljs-template_comment,.diff .hljs-header,.hljs-doctype,.hljs-pi,.lisp .hljs-string,.hljs-javadoc { color: #586e75 } .hljs-keyword,.hljs-winutils,.method,.hljs-addition,.css .hljs-tag,.hljs-request,.hljs-status,.nginx .hljs-title { color: #859900 } .hljs-number,.hljs-command,.hljs-string,.hljs-tag .hljs-value,.hljs-rules .hljs-value,.hljs-phpdoc,.hljs-dartdoc,.tex .hljs-formula,.hljs-regexp,.hljs-hexcolor,.hljs-link_url { color: #2aa198 } .hljs-title,.hljs-localvars,.hljs-chunk,.hljs-decorator,.hljs-built_in,.hljs-identifier,.vhdl .hljs-literal,.hljs-id,.css .hljs-function { color: #268bd2 } .hljs-attribute,.hljs-variable,.lisp .hljs-body,.smalltalk .hljs-number,.hljs-constant,.hljs-class .hljs-title,.hljs-parent,.hljs-type,.hljs-link_reference { color: #b58900 } .hljs-preprocessor,.hljs-preprocessor .hljs-keyword,.hljs-pragma,.hljs-shebang,.hljs-symbol,.hljs-symbol .hljs-string,.diff .hljs-change,.hljs-special,.hljs-attr_selector,.hljs-subst,.hljs-cdata,.css .hljs-pseudo,.hljs-header { color: #cb4b16 } .hljs-deletion,.hljs-important { color: #dc322f } .hljs-link_label { color: #6c71c4 } .tex .hljs-formula { background: #073642 } *,*::before,*::after { } html { } body { margin: 0 } article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary { display: block } audio,canvas,progress,video { display: inline-block; vertical-align: baseline } audio:not([controls]) { display: none; height: 0 } [hidden],template { display: none } a { background: 0 0 } a:active,a:hover { outline: 0 } abbr[title] { border-bottom: 1px dotted } b,strong { font-weight: 700 } dfn { font-style: italic } h1 { margin: .67em 0 } mark { background: #ff0; color: #000 } small { font-size: 80% } sub,sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline } sup { top: -.5em } sub { bottom: -.25em } images { border: 0 } svg:not(:root) { overflow: hidden } figure { margin: 1em 40px } hr { height: 0 } pre { overflow: auto } code,kbd { font-size: 1em } code,kbd,pre,samp { font-family: monospace, monospace } samp { font-size: 1em } button,input,optgroup,select,textarea { color: inherit; font: inherit; margin: 0 } button { overflow: visible } button,select { text-transform: none } button,html input[type="button"],input[type="reset"],input[type="submit"] { cursor: pointer } button[disabled],html input[disabled] { cursor: default } button::-moz-focus-inner,input::-moz-focus-inner { border: 0; padding: 0 } input { line-height: normal } input[type="checkbox"],input[type="radio"] { padding: 0 } input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button { height: auto } input[type="search"] { } input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration { } fieldset { border: 1px solid silver; margin: 0 2px; padding: .35em .625em .75em } legend { border: 0; padding: 0 } textarea { overflow: auto } optgroup { font-weight: 700 } table { border-collapse: collapse; border-spacing: 0 } .debug { background-color: #ffc0cb !important } .ellipsis { overflow: hidden; white-space: nowrap } .ir { background-color: transparent; border: 0; overflow: hidden } .ir::before { content: ""; display: block; height: 150%; width: 0 } html { font-size: .875em; background: #fff; color: #373d49 } html,body { font-family: georgia, cambria, serif; height: 100% } body { font-size: 1rem; font-weight: 400; line-height: 2rem } ul,ol { margin-bottom: .83999rem; padding-top: .16001rem } li { margin-left: 1rem } li>ul,li>ol { margin-bottom: 0 } p { padding-top: .66001rem; margin-top: 0 } p,pre { margin-bottom: 1.33999rem } pre { font-size: 1rem; padding: .66001rem 9.5px 9.5px; line-height: 2rem; background: linear-gradient(to bottom,#fff 0,#fff .75rem,#f5f7fa .75rem,#f5f7fa 2.75rem,#fff 2.75rem,#fff 4rem); border-color: #d3daea } blockquote { margin: 0 } blockquote p { font-size: 1rem; margin-bottom: .33999rem; font-style: italic; padding: .66001rem 1rem 1rem; border-left: 3px solid #a0aabf } th,td { padding: 12px } h1,h2,h3,h4,h5,h6 { font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-style: normal; font-weight: 600; margin-top: 0 } h1 { line-height: 3rem; font-size: 2.0571429rem; margin-bottom: .21999rem; padding-top: .78001rem } h2 { font-size: 1.953125rem; margin-bottom: .1835837rem; padding-top: .8164163rem } h2,h3 { line-height: 3rem } h3 { font-size: 1.6457143rem; margin-bottom: .07599rem; padding-top: .92401rem } h4 { font-size: 1.5625rem; margin-bottom: .546865rem; padding-top: .453135rem } h5 { font-size: 1.25rem; margin-bottom: -.56251rem; padding-top: .56251rem } h6 { font-size: 1rem; margin-bottom: -.65001rem; padding-top: .65001rem } a { cursor: pointer; color: #35d7bb; text-decoration: none } a:hover,a:focus { border-bottom-color: #35d7bb; color: #dff9f4 } img { height: auto; max-width: 100% } .g { display: block } .g::after { clear: both; content: ""; display: table } .g-b { float: left; margin: 0; width: 100% } .g { margin-left: -16px; margin-right: -16px } .g-b { padding-left: 16px; padding-right: 16px } .g-b--center { display: block; float: none; margin: 0 auto } .g-b--right { float: right } .g-b--1of1 { width: 100% } .g-b--1of2,.g-b--2of4,.g-b--3of6,.g-b--4of8,.g-b--5of10,.g-b--6of12 { width: 50% } .g-b--1of3,.g-b--2of6,.g-b--4of12 { width: 33.333% } .g-b--2of3,.g-b--4of6,.g-b--8of12 { width: 66.666% } .g-b--1of4,.g-b--2of8,.g-b--3of12 { width: 25% } .g-b--3of4,.g-b--6of8,.g-b--9of12 { width: 75% } .g-b--1of5,.g-b--2of10 { width: 20% } .g-b--2of5,.g-b--4of10 { width: 40% } .g-b--3of5,.g-b--6of10 { width: 60% } .g-b--4of5,.g-b--8of10 { width: 80% } .g-b--1of6,.g-b--2of12 { width: 16.666% } .g-b--5of6,.g-b--10of12 { width: 83.333% } .g-b--1of8 { width: 12.5% } .g-b--3of8 { width: 37.5% } .g-b--5of8 { width: 62.5% } .g-b--7of8 { width: 87.5% } .g-b--1of10 { width: 10% } .g-b--3of10 { width: 30% } .g-b--7of10 { width: 70% } .g-b--9of10 { width: 90% } .g-b--1of12 { width: 8.333% } .g-b--5of12 { width: 41.666% } .g-b--7of12 { width: 58.333% } .g-b--11of12 { width: 91.666% } .g-b--push--1of1 { margin-left: 100% } .g-b--push--1of2,.g-b--push--2of4,.g-b--push--3of6,.g-b--push--4of8,.g-b--push--5of10,.g-b--push--6of12 { margin-left: 50% } .g-b--push--1of3,.g-b--push--2of6,.g-b--push--4of12 { margin-left: 33.333% } .g-b--push--2of3,.g-b--push--4of6,.g-b--push--8of12 { margin-left: 66.666% } .g-b--push--1of4,.g-b--push--2of8,.g-b--push--3of12 { margin-left: 25% } .g-b--push--3of4,.g-b--push--6of8,.g-b--push--9of12 { margin-left: 75% } .g-b--push--1of5,.g-b--push--2of10 { margin-left: 20% } .g-b--push--2of5,.g-b--push--4of10 { margin-left: 40% } .g-b--push--3of5,.g-b--push--6of10 { margin-left: 60% } .g-b--push--4of5,.g-b--push--8of10 { margin-left: 80% } .g-b--push--1of6,.g-b--push--2of12 { margin-left: 16.666% } .g-b--push--5of6,.g-b--push--10of12 { margin-left: 83.333% } .g-b--push--1of8 { margin-left: 12.5% } .g-b--push--3of8 { margin-left: 37.5% } .g-b--push--5of8 { margin-left: 62.5% } .g-b--push--7of8 { margin-left: 87.5% } .g-b--push--1of10 { margin-left: 10% } .g-b--push--3of10 { margin-left: 30% } .g-b--push--7of10 { margin-left: 70% } .g-b--push--9of10 { margin-left: 90% } .g-b--push--1of12 { margin-left: 8.333% } .g-b--push--5of12 { margin-left: 41.666% } .g-b--push--7of12 { margin-left: 58.333% } .g-b--push--11of12 { margin-left: 91.666% } .g-b--pull--1of1 { margin-right: 100% } .g-b--pull--1of2,.g-b--pull--2of4,.g-b--pull--3of6,.g-b--pull--4of8,.g-b--pull--5of10,.g-b--pull--6of12 { margin-right: 50% } .g-b--pull--1of3,.g-b--pull--2of6,.g-b--pull--4of12 { margin-right: 33.333% } .g-b--pull--2of3,.g-b--pull--4of6,.g-b--pull--8of12 { margin-right: 66.666% } .g-b--pull--1of4,.g-b--pull--2of8,.g-b--pull--3of12 { margin-right: 25% } .g-b--pull--3of4,.g-b--pull--6of8,.g-b--pull--9of12 { margin-right: 75% } .g-b--pull--1of5,.g-b--pull--2of10 { margin-right: 20% } .g-b--pull--2of5,.g-b--pull--4of10 { margin-right: 40% } .g-b--pull--3of5,.g-b--pull--6of10 { margin-right: 60% } .g-b--pull--4of5,.g-b--pull--8of10 { margin-right: 80% } .g-b--pull--1of6,.g-b--pull--2of12 { margin-right: 16.666% } .g-b--pull--5of6,.g-b--pull--10of12 { margin-right: 83.333% } .g-b--pull--1of8 { margin-right: 12.5% } .g-b--pull--3of8 { margin-right: 37.5% } .g-b--pull--5of8 { margin-right: 62.5% } .g-b--pull--7of8 { margin-right: 87.5% } .g-b--pull--1of10 { margin-right: 10% } .g-b--pull--3of10 { margin-right: 30% } .g-b--pull--7of10 { margin-right: 70% } .g-b--pull--9of10 { margin-right: 90% } .g-b--pull--1of12 { margin-right: 8.333% } .g-b--pull--5of12 { margin-right: 41.666% } .g-b--pull--7of12 { margin-right: 58.333% } .g-b--pull--11of12 { margin-right: 91.666% } .splashscreen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #373d49; z-index: 22 } .splashscreen-dillinger { width: 260px; height: auto; display: block; margin: 0 auto; padding-bottom: 3rem } .splashscreen p { font-size: 1.25rem; padding-top: .56251rem; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-weight: 400; text-align: center; max-width: 500px; margin: 0 auto; color: #fff } .sp-center { position: relative; top: 50% } .open-menu>.wrapper { } .page { margin: 0 auto; position: relative; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; background-color: #fff; padding-top: 51px } .open-menu .page { left: 270px } .title { line-height: 1rem; font-size: .8rem; margin-bottom: .77999rem; padding-top: .22001rem; font-weight: 500; color: #a0aabf; letter-spacing: 1px; text-transform: uppercase; padding-left: 16px; padding-right: 16px; margin-top: 1rem } .split-preview .title { padding-left: 0 } .title-document { line-height: 1rem; font-size: 1.25rem; margin-bottom: .89999rem; padding-top: .10001rem; font-weight: 400; font-family: "Ubuntu Mono", monaco; color: #373d49; padding-left: 16px; padding-right: 16px; width: 80%; min-width: 300px; outline: 0; border: none } .icon { display: block; margin: 0 auto; width: 36px; height: 36px; text-align: center } .icon svg { display: inline-block; margin-left: auto; margin-right: auto } .icon-preview { background-color: #373d49; line-height: 40px } .icon-preview svg { width: 19px; height: 12px } .icon-settings { background-color: #373d49; line-height: 44px } .icon-settings svg { width: 18px; height: 18px } .icon-link { width: 16px; height: 16px; line-height: 1; margin-right: 24px; text-align: right } .navbar { background-color: #373d49; height: 51px; width: 100%; position: fixed; top: 0; left: 0; z-index: 6 } .navbar::after { content: ""; display: table; clear: both } .open-menu .navbar { left: 270px } .navbar-brand { float: left; margin: 0 0 0 24px; padding: 0; line-height: 42px } .navbar-brand svg { width: 85px; height: 11px } .nav-left { float: left } .nav-right { float: right } .nav-sidebar { width: 100% } .menu { list-style: none; margin: 0; padding: 0 } .menu a { border: 0; color: #a0aabf; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; outline: none; text-transform: uppercase } .menu a:hover { color: #35d7bb } .menu .menu-item { border: 0; display: none; float: left; margin: 0; position: relative } .menu .menu-item>a { display: block; font-size: 12px; height: 51px; letter-spacing: 1px; line-height: 51px; padding: 0 24px } .menu .menu-item--settings,.menu .menu-item--preview,.menu .menu-item--save-to.in-sidebar,.menu .menu-item--import-from.in-sidebar,.menu .menu-item--link-unlink.in-sidebar,.menu .menu-item--documents.in-sidebar { display: block } .menu .menu-item--documents { padding-bottom: 1rem } .menu .menu-item.open>a { background-color: #1d212a } .menu .menu-item-icon>a { height: auto; padding: 0 } .menu .menu-item-icon:hover>a { background-color: transparent } .menu .menu-link.open i { background-color: #1d212a } .menu .menu-link.open g { } .menu .menu-link-preview,.menu .menu-link-settings { margin-top: 8px; width: 51px } .menu-sidebar { width: 100% } .menu-sidebar .menu-item { float: none; margin-bottom: 1px; width: 100% } .menu-sidebar .menu-item.open>a { background-color: #373d49 } .menu-sidebar .open .caret { } .menu-sidebar>.menu-item:hover .dropdown a,.menu-sidebar>.menu-item:hover .settings a { background-color: transparent } .menu-sidebar .menu-link { background-color: #373d49; font-weight: 600 } .menu-sidebar .menu-link::after { content: ""; display: table; clear: both } .menu-sidebar .menu-link>span { float: left } .menu-sidebar .menu-link>.caret { float: right; text-align: right; top: 22px } .menu-sidebar .dropdown,.menu-sidebar .settings { background-color: transparent; position: static; width: 100% } .dropdown { position: absolute; right: 0; top: 51px; width: 188px } .dropdown,.settings { display: none; background-color: #1d212a } .dropdown { padding: 0 } .dropdown,.settings,.sidebar-list { list-style: none; margin: 0 } .sidebar-list { padding: 0 } .dropdown li { margin: 32px 0; padding: 0 0 0 32px } .dropdown li,.settings li { line-height: 1 } .sidebar-list li { line-height: 1; margin: 32px 0; padding: 0 0 0 32px } .dropdown a { color: #d0d6e2 } .dropdown a,.settings a,.sidebar-list a { display: block; text-transform: none } .sidebar-list a { color: #d0d6e2 } .dropdown a::after,.settings a::after,.sidebar-list a::after { content: ""; display: table; clear: both } .dropdown .icon,.settings .icon,.sidebar-list .icon { float: right } .open .dropdown,.open .settings,.open .sidebar-list { display: block } .open .dropdown.collapse,.open .collapse.settings,.open .sidebar-list.collapse { display: none } .open .dropdown.collapse.in,.open .collapse.in.settings,.open .sidebar-list.collapse.in { display: block } .dropdown .unlinked .icon,.settings .unlinked .icon,.sidebar-list .unlinked .icon { opacity: .3 } .dropdown.documents li,.documents.settings li,.sidebar-list.documents li { background-image: url("../img/icons/file.svg"); background-position: 240px center; background-repeat: no-repeat; padding: 3px 32px } .dropdown.documents li.octocat,.documents.settings li.octocat,.sidebar-list.documents li.octocat { background-image: url("../img/icons/octocat.svg"); background-position: 234px center } .dropdown.documents li:last-child,.documents.settings li:last-child,.sidebar-list.documents li:last-child { margin-bottom: 1rem } .dropdown.documents li.active a,.documents.settings li.active a,.sidebar-list.documents li.active a { color: #35d7bb } .settings { position: fixed; top: 67px; right: 16px; width: 288px; background-color: #373d49; padding: 16px; z-index: 7 } .show-settings .settings { display: block } .settings .has-checkbox { float: left } .settings a { font-size: 1.25rem; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-weight: 400; line-height: 28px; color: #d0d6e2 } .settings a::after { content: ""; display: table; clear: both } .settings a:hover { color: #35d7bb } .settings li { border-bottom: 1px solid #4f535b; margin: 0; padding: 16px 0 } .settings li:last-child { border-bottom: none } .brand { border: none; display: block } .brand:hover g { } .toggle { display: block; float: left; height: 16px; padding: 25px 16px 26px; width: 40px } .toggle span::after,.toggle span::before { content: ""; left: 0; position: absolute; top: -6px } .toggle span::after { top: 6px } .toggle span { display: block; position: relative } .toggle span,.toggle span::after,.toggle span::before { background-color: #d3daea; height: 2px; width: 20px } .open-menu .toggle span { background-color: transparent } .open-menu .toggle span::before { } .open-menu .toggle span::after { } .caret { display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: middle; position: relative; top: -1px; border-top: 4px solid; border-right: 4px solid transparent; border-left: 4px solid transparent } .sidebar { overflow: auto; height: 100%; padding-right: 15px; padding-bottom: 15px; width: 285px } .sidebar-wrapper { background-color: #2b2f36; left: 0; height: 100%; position: fixed; top: 0; width: 285px; z-index: 1 } .sidebar-branding { width: 160px; padding: 0; margin: 16px auto } .header { border-bottom: 1px solid #e8e8e8; position: relative } .words { line-height: 1rem; font-size: .8rem; margin-bottom: .77999rem; padding-top: .22001rem; font-weight: 500; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; color: #a0aabf; letter-spacing: 1px; text-transform: uppercase; z-index: 5; position: absolute; right: 16px; top: 0 } .words span { color: #000 } .btn { text-align: center; display: inline-block; width: 100%; text-transform: uppercase; font-weight: 600; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-size: 14px; padding: 16px 24px; background-color: #35d7bb; margin: 0 auto 16px; line-height: 1; color: #fff } .btn--new,.btn--save { display: block; width: 238px } .btn--new:hover,.btn--new:focus,.btn--save:hover,.btn--save:focus { color: #fff; border-bottom-color: transparent } .btn--save { background-color: #4a5261 } .btn--save:hover,.btn--save:focus { color: #fff; border-bottom-color: transparent } .btn--delete { display: block; width: 238px; background-color: transparent; font-size: 12px } .btn--delete:hover,.btn--delete:focus { color: #fff; border-bottom-color: transparent; opacity: .8 } .btn--delete-modal,.btn--ok,.btn--close { border-top: 0; background-color: #4a5261; margin: 0 } .btn--delete-modal:hover,.btn--delete-modal:focus,.btn--ok:hover,.btn--ok:focus,.btn--close:hover,.btn--close:focus { color: #fff; background-color: #292d36 } .btn--delete-modal { display: inline; width: auto } .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(55,61,73,.8); z-index: 5; opacity: 0; visibility: hidden } .show-settings .overlay { visibility: visible; opacity: 1 } .switch { float: right; line-height: 1 } .switch input { display: none } .switch small { display: inline-block; cursor: pointer; padding: 0 24px 0 0; background-color: #2b2f36; border-color: #2b2f36 } .switch small,.switch small::before { } .switch small::before { display: block; content: ""; width: 28px; height: 28px; background: #fff } .switch.checked small { padding-right: 0; padding-left: 24px; background-color: #35d7bb } .modal--dillinger.about .modal-dialog { font-size: 1.25rem; max-width: 500px } .modal--dillinger.scope .modal-dialog { max-width: 300px; margin: 5rem auto } .modal--dillinger .modal-dialog { max-width: 600px; width: auto; margin: 5rem auto } .modal--dillinger .modal-content { background: #373d49; color: #fff; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-weight: 400; padding: 2rem } .modal--dillinger ul { list-style-type: disc; margin: 1rem 0; padding: 0 0 0 1rem } .modal--dillinger li { padding: 0; margin: 0 } .modal--dillinger .modal-header { border: 0; padding: 0 } .modal--dillinger .modal-body { padding: 0 } .modal--dillinger .modal-footer { border: 0; padding: 0 } .modal--dillinger .close { color: #fff; opacity: 1 } .modal-backdrop { background-color: #373d49 } .pagination--dillinger { padding: 0 !important; margin: 1.5rem 0 !important } .pagination--dillinger,.pagination--dillinger li { display: flex } .pagination--dillinger li { text-align: center } .pagination--dillinger li:first-child>a,.pagination--dillinger li.disabled>a,.pagination--dillinger li.disabled>a:hover,.pagination--dillinger li.disabled>a:focus,.pagination--dillinger li>a { background-color: transparent; border-color: #4f535b; border-right-color: transparent } .pagination--dillinger li.active>a,.pagination--dillinger li.active>a:hover,.pagination--dillinger li.active>a:focus { border-color: #4a5261; background-color: #4a5261; color: #fff } .pagination--dillinger li>a { float: none; color: #fff; width: 100%; display: block; text-align: center; margin: 0; border-right-color: transparent; padding: 6px } .pagination--dillinger li>a:hover,.pagination--dillinger li>a:focus { border-color: #35d7bb; background-color: #35d7bb; color: #fff } .pagination--dillinger li:last-child a { border-color: #4f535b } .pagination--dillinger li:first-child a { border-right-color: transparent } .dinotify { position: absolute; z-index: 9999; left: 0; right: 0; top: 0; margin: 0 auto; max-width: 400px; text-align: center; visibility: hidden } .dinotify-body { background-color: #35d7bb; background: #666e7f; color: #fff; font-family: "Source Sans Pro", "Helvetica Neue", helvetica, arial, sans-serif; font-weight: 400; overflow: hidden; padding: 1rem 2rem .5rem; display: flex } .dinotify-icon { display: block; width: 16px; height: 16px; line-height: 16px; position: relative; top: 3px } .dinotify-message { padding-left: 1rem } .zen-wrapper { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; z-index: 10; background-color: #fff; opacity: 0 } .zen-wrapper.on { opacity: 1 } .enter-zen-mode { background-image: url("../img/icons/enter-zen.svg"); right: .5rem; top: .313rem; display: none } .enter-zen-mode,.close-zen-mode { font: 0/0 a; color: transparent; background-color: transparent; border: 0; background-repeat: no-repeat; width: 32px; height: 32px; display: block; position: absolute } .close-zen-mode { background-image: url("../img/icons/exit-zen.svg"); right: 1rem; top: 1rem } .zen-page { position: relative; top: 0; bottom: 0; z-index: 11; height: 100%; width: 100% } #zen { font-size: 1.25rem; width: 300px; height: 80%; margin: 0 auto; position: relative; top: 10% } #zen::before,#zen::after { content: ""; position: absolute; height: 10%; width: 100%; z-index: 12 } #preview .table { width: auto } .ui-resizable { position: relative } .ui-resizable-handle { position: absolute; font-size: .1px; z-index: 99999; display: block } .ui-resizable-e { background-color: #666; border-right: 8px solid #e8e8e8; border-left: 1px solid #222; width: 10px; z-index: 88 !important; position: relative } .ui-resizable-e::after { content: "-"; display: block; position: absolute; top: calc(50% - 16px); left: 0; height: 25px; width: 2px; background-color: rgba(0,0,0,.4); margin: 3px } #editor { cursor: ew-resize; position: relative; z-index: auto } .profile-pic { float: left; width: 250px } #_default_ a::before { color: #a0aabf } #_default_ img { display: none } #_default_ #_default_ { display: block; float: left; max-width: 38% } #_default_ .default-ad { display: none } #_default_ ._default_ { display: block } #_default_ a { color: #35d7bb; text-decoration: none } #_default_ a:hover { color: #8ae8d8 } #_default_ .default-image { display: none } #_default_ .default-title::after { content: " — " } #_default_ .default-title,#_default_ .default-description { display: inline } #_default_ .default-title { position: relative; font-weight: 600; display: none } #_default_ a::before { position: relative; top: 0; padding: 5px; color: #a0aabf; content: "Ad"; text-transform: uppercase; font-size: 8px; font-family: verdana, sans-serif } #_default_ { display: block; float: left; max-width: 38% } #_default_ ._default_ { display: block; font-size: .75rem; height: 51px; letter-spacing: 1px; line-height: 1rem; padding: 18px 24px } .split { overflow: scroll; padding: 0 !important } .split-editor { padding-left: 0; padding-right: 0; position: relative; z-index: 3 } .show-preview .split-editor { display: none } .split-preview { background-color: #fff; display: none; top: 0; position: relative; z-index: 4 } .show-preview .split-preview { display: block } #editor { font-size: 1rem; font-family: "Ubuntu Mono", monaco; font-weight: 400; line-height: 2rem; width: 100%; height: 100% } #editor .ace_gutter { } .editor-header { width: 50%; float: left; border-bottom: 1px solid #e8e8e8; position: relative } .editor-header--first { border-right: 1px solid #e8e8e8 } .editor-header .title { display: inline-block } #preview { padding: 15px } #preview a { color: #a0aabf; text-decoration: underline } .sr-only { visibility: hidden; overflow: hidden; top: -100px; position: absolute } .mnone { margin: 0 !important }</style>

Stackoverflow上关于python的问题
备忘:

for i, value in enumerate(my_list):
    pass
for name, value in my_dict.items():
    pass
  • 实例有_class_、__dict__属性
  • 类有__name__属性
  • is是对比地址,==是对比值

1.mutableimmutable数据

在python中,strings, tuples, 和numbers是不可更改的对象,而list, dict等则是可以修改的对象。

  • strings tuples numbers 值传递
  • list dict 引用传递

在函数内部,传进来的参数是对引用的复制。

2.类变量与实例变量:

class Person:
    name=[]
p1=Person()
p2=Person()
p1.name.append(1)
print p1.name
print p2.name
print Person.name
>>>[1]
>>>[1]
>>>[1]

3.metaclass

  • 一个class的实例的type是该class
  • 一个class的type是‘type’
  • type是一个metaclass

type是所有对象的元类
type(类名, 父类的元组(针对继承的情况,可以为空),包含属性的字典(名称和值))

class Foo(object):
    bar = True

等价于

Foo = type(‘Foo‘, (), {‘bar‘:True})
>>>print Foo.bar
True

4.类方法与静态方法

def foo(x):
    print "executing foo(%s)"%(x)
class A(object):
    def foo(self,x):#实例方法
        print "executing foo(%s,%s)"%(self,x)
    @classmethod
    def class_foo(cls,x):#类方法
        print "executing class_foo(%s,%s)"%(cls,x)
    @staticmethod
    def static_foo(x):#静态方法,不需要与class绑定
        print "executing static_foo(%s)"%x
a=A()
\ 实例方法 类方法 静态方法
a = A() a.foo(x) a.class_foo(x) a.static_foo(x)
A 不可用 A.class_foo(x) A.static_foo(x)

5.python自省

运行时能够获得对象的类型.比如type(),dir(),getattr(),hasattr(),isinstance().

6.单下划线和双下划线成员方法

class ClassName:
    def __init__(self):
        self.__superprivate = "Hello" # 解析器用_classname__foo来代替这个名字,以区别和其他类相同的命名.
        self._semiprivate = ", world!" # protected member,在外部访问不会报错,但pycharm会警告
mc = ClassName()
print mc._ClassName__superprivate
print mc._semiprivate
print mc.__dict__
>>>Hello
>>>, world!
>>>{‘_ClassName__superprivate‘: ‘Hello‘, ‘_semiprivate‘: ‘, world!‘}

7.格式化输出

  • :号后面带填充的字符,只能是一个字符,不指定的话默认是用空格填充
  • ^、<、>分别是居中、左对齐、右对齐,后面带宽度
In [15]: ‘{:>8}‘.format(‘189‘)
Out[15]: ‘   189‘
In [16]: ‘{:0>8}‘.format(‘189‘)
Out[16]: ‘00000189‘
In [17]: ‘{:a>8}‘.format(‘189‘)
Out[17]: ‘aaaaa189‘
In [44]: ‘{:.2f}‘.format(321.33345)
Out[44]: ‘321.33‘
In [5]: ‘{name},{age}‘.format(age=18,name=‘kzc‘) 
Out[5]: ‘kzc,18‘
In [54]: ‘{:b}‘.format(17) # 二进制
Out[54]: ‘10001‘
In [55]: ‘{:d}‘.format(17) # 十进制
Out[55]: ‘17‘
In [56]: ‘{:o}‘.format(17) # 八进制
Out[56]: ‘21‘
In [57]: ‘{:x}‘.format(17) # 十六进制
Out[57]: ‘11‘
name = (1,2,3)
"hi there %s" % name
>>>报错
"hi there %s" % (name,)
>>>‘hi there (1, 2, 3)‘

打印带中文的字典:

print json.dumps(cursor.next(), ensure_ascii=False, encoding=‘utf-8‘)

8.生成器

生成器也是迭代器的一种,但是你只能迭代它们一次.原因很简单,因为它们不是全部存在内存里,它们只在要调用的时候在内存里生成

>>> def createGenerator():
...    mylist = range(3)
...    for i in mylist:
...        yield i*i # 调用函数时返回生成器对象
...
>>> mygenerator = createGenerator() # 创建生成器
>>> print(mygenerator) # mygenerator is an object!
<generator object createGenerator at 0xb7555c34>
>>> print mygenerator.next()
0
>>> for i in mygenerator:
...     print(i)
1
4

遍历生成器时,首先计算0,然后会在内存里丢掉0去计算1,直到计算完4.
要理解Yield你必须先理解当你调用函数的时候,函数里的代码并没有运行.函数仅仅返回生成器对象,这就是它最微妙的地方.

9.装饰器

# 字体变粗装饰器
def makebold(fn):
    # 装饰器将返回新的函数
    def wrapper():
        # 在之前或者之后插入新的代码
        return "<b>" + fn() + "</b>"
    return wrapper

# 斜体装饰器
def makeitalic(fn):
    # 装饰器将返回新的函数
    def wrapper():
        # 在之前或者之后插入新的代码
        return "<i>" + fn() + "</i>"
    return wrapper

@makebold # 后装饰
@makeitalic # 先装饰
def say():
    return "hello"

print say()
#输出: <b><i>hello</i></b>

# 这相当于
def say():
    return "hello"
say = makebold(makeitalic(say))

print say()
#输出: <b><i>hello</i></b>

10.解包

  • 用list中的值作参数时,用*对list解包:func(*my_list)
  • 用dict中的值作参数时,用**对dict解包:func(**my_dict)

11.鸭子类型

“当看到一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么这只鸟就可以被称为鸭子。”

我们并不关心对象是什么类型,到底是不是鸭子,只关心行为。比如在python中,有很多file-like的东西,比如StringIO,GzipFile,socket。它们有很多相同的方法,我们把它们当作文件使用。又比如list.extend()方法中,我们并不关心它的参数是不是list,只要它是可迭代的,所以它的参数可以是list/tuple/dict/字符串/生成器等.鸭子类型在动态语言中经常使用,非常灵活,使得python不想java那样专门去弄一大堆的设计模式。

12.新式类

继承object的类是新式类

1. _new_,__init__方法:

这两个方法是用来创建object的子类对象,静态方法_new()用来创建类的实例,然后再调用_init()来初始化实例。

2. _delattr, _getattribute, __setattr__方法:

对象使用这些方法来处理属性的访问

3. _hash, _repr, __str__方法:

print(someobj)会调用someobj._str_(), 如果_str__没有定义,则会调用someobj._repr(),

_str_()和**_repr_()**的区别:

  • 默认的实现是没有任何作用的
  • __repr__的目标是对象信息唯一性
  • __str__的目标是对象信息的可读性
  • 容器对象的_str__一般使用的是对象元素的_repr
  • 如果重新定义了_repr,而没有定义_str,则默认调用_str__时,调用的是_repr,也就是说好的编程习惯是每一个类都需要重写一个__repr__方法,用于提供对象的可读信息,而重写__str__方法是可选的。实现__str__方法,一般是需要更加好看的打印效果,比如你要制作一个报表的时候等。
  • 可以允许object的子类重载这些方法,或者添加新的方法。

4.__new__来实现Singleton单例模式:

class Singleton(object):
    _instance = list()
    def __new__(cls): # Singleton类重写的父类object的__new__函数。
        if not cls._instance:  # 若还没有任何实例
            cls._instance.append(object.__new__(cls))  # 生成一个实例
            # cls._instance.append(super(Singleton,cls).__new__(cls))
        return cls._instance[0]  # 返回这个实例
a = Singleton()
b = Singleton()
print id(a)
print id(b)
# a和b指向同一个实例
>>>140097338089808
>>>140097338089808

5.__slots__属性

默认情况下,python对象队象的每个实例(instance)都会有一个字典_dict__来存储该实例的属性,这样做的好处在于运行时期每个对象可以任意设置新的属性。而相对应的坏处是,当创建成百上千个这样的实例的时候回很浪费内存。所以引入_slots,用来指定实例只拥有固定的属性,因此python会给每个实例对象分配固定的内存空间,从而减少内存消耗。而且使用__slots__可以加快属性的访问。

class A:
    def __init__(self):
        self.x = 1
        self.y = 2
class B(object):
    def __init__(self):
        self.x = 1
        self.y = 2
    __slots__ = ‘x‘, ‘y‘ # 限制class B的成员只有x,y
a = A()
b = B()
print a.__dict__
>>>{‘y‘: 2, ‘x‘: 1}
print b.__dict__
>>>AttributeError: ‘B‘ object has no attribute ‘__dict__‘
a.z = 3 # ok
b.z = 3
>>>AttributeError: ‘B‘ object has no attribute ‘z‘

使用时__slots__时需要注意的几点:

1.  当一个类的父类没有定义__slots__属性,父类中的__dict__属性总是可以访问到的,所以只在子类中定义__slots__属性,而不在父类中定义是没有意义的。
 
2. 如果定义了__slots属性,还是想在之后添加新的变量,就需要把‘__dict__‘字符串添加到__slots__的元组里。
 
3. 定义了__slots__属性,还会消失的一个属性是__weakref__,这样就不支持实例的weak reference,如果还是想用这个功能,同样,可以把‘__weakref__‘字符串添加到元组里。
 
4. __slots__功能是通过descriptor实现的,会为每一个变量创建一个descriptor。
 
5. __slots__的功能只影响定义它的类,因此,子类需要重新定义__slots__才能有它的功能。

6.__getattribute__方法

class MyList(list): # 一个没有append方法的list
    def __getattribute__(self, item):
        if item == ‘append‘:
            raise AttributeError, item
        return list.__getattribute__(self, item)
a = MyList()
a.append() # AttributeError: append

7.__getitem__方法

要使新式类的对象支持indexing,必须在新式类中显式地定义_getitem_

class MyList(list):
    def __getitem__(self, item):
        return item
a = MyList()
print a[1] # 1

8.MRO(Method Resolution Order,方法解析顺序)

    A[A<br>a] --> B[B]
    A --> C[C<br>a]
    B --> D[D]
    C --> D[D]

A是B和C的父类,D是B和C的子类
obj=D()
obj.a()
obj调用a方法:
经典类的查找顺序为D->B->A->C,深度优先,会调用A的a方法,这是一个bug;
新式类的查找顺序为D->B->C->A,广度优先,会调用C的a方法。

9.调用父类的方法

class A(object):
    def foo(self):
        print "A‘s foo"
    def a(self):
        print "A‘s a"
class B(A):
    def foo(self):
        print "B‘s foo"
        super(B, self).foo()
class C(A):
    def foo(self):
        print "C‘s foo"
        super(C, self).foo()
    def a(self):
        print "C‘s a"
class D(B, C):
    def foo(self):
        print "D‘s foo"
        super(D, self).foo()
obj = D()
obj.a() # C‘s a
obj.foo() 
>>>D‘s foo
>>>B‘s foo
>>>C‘s foo
>>>A‘s foo # 采用super可以保证A中的foo只执行一次

10.__new__和__init__的区别

  • __new__是一个静态方法,而__init__是一个实例方法.
  • __new__方法会返回一个创建的实例,而__init__什么都不返回.
  • 只有在__new__返回一个cls的实例时后面的__init__才能被调用.
  • 当创建一个新实例时调用_new,初始化一个实例时用_init.
  • ps: 使用_metaclass_,__new__和__init__来分别在类创建,实例创建和实例初始化的时候做一些小手脚.

13.作用域

A[本地作用域 Local] --> B[当前作用域被嵌入的本地作用域 Enclosing locals]
B --> C[全局/模块作用域 Enclosing locals]
C --> D[内置作用域 Built-in]

14.filter、map、reduce

>>>a = [1,2,3,4,5,6,7]
>>>b = filter(lambda x: x > 5, a) # 调用一个布尔函数
>>>print b
[6,7]
>>> a = map(lambda x:x*2,[1,2,3])
>>> list(a)
[2, 4, 6]
>>> reduce(lambda x,y:x*y,range(1,4)) # 对一个序列的每个项迭代调用函数,是求3的阶乘
6

15.python拷贝

import copy
a = [1, 2, 3, 4, [‘a‘, ‘b‘]]  #原始对象

b = a  #赋值,传对象的引用
c = copy.copy(a)  #对象拷贝,浅拷贝
d = copy.deepcopy(a)  #对象拷贝,深拷贝

a.append(5)  #修改对象a
a[4].append(‘c‘)  #修改对象a中的[‘a‘, ‘b‘]数组对象

print ‘a = ‘, a
print ‘b = ‘, b
print ‘c = ‘, c
print ‘d = ‘, d

输出结果:
a =  [1, 2, 3, 4, [‘a‘, ‘b‘, ‘c‘], 5]
b =  [1, 2, 3, 4, [‘a‘, ‘b‘, ‘c‘], 5]
c =  [1, 2, 3, 4, [‘a‘, ‘b‘, ‘c‘]]
d =  [1, 2, 3, 4, [‘a‘, ‘b‘]]

16.Python 2.7.x 和 3.x 版本的重要区别

python笔记