Commit 7c3fad8a authored by Jon Shadforth's avatar Jon Shadforth
Browse files

Added more examples

parent d7be4b90
......@@ -56,7 +56,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 7,
"metadata": {},
"outputs": [
{
......@@ -90,7 +90,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 8,
"metadata": {},
"outputs": [
{
......@@ -119,7 +119,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {},
"outputs": [
{
......@@ -149,7 +149,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 10,
"metadata": {},
"outputs": [
{
......@@ -179,7 +179,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 11,
"metadata": {},
"outputs": [
{
......@@ -194,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
......@@ -204,7 +204,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
......@@ -238,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 14,
"metadata": {},
"outputs": [
{
......@@ -282,7 +282,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 15,
"metadata": {},
"outputs": [
{
......@@ -311,7 +311,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 16,
"metadata": {},
"outputs": [
{
......@@ -339,13 +339,13 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Decimal: 65537\nBinary: 10000000000000001\nOctal: 200001\nHex: 10001\nHex (uppercase): 10001\n\nBinary (alternate): 0b10000000000000001\nOctal (alternate): 0o200001\nHex (alternate): 0x10001\nHex (uppercase, alternate): 0X10001\n\nBinary, underscore seperator: 1_0000_0000_0000_0001\nOctal, underscore seperator: 20_0001\nHex, underscore seperator: 1_0001\nHex, uppercase, underscore seperator: 1_0001\n"
"text": "Decimal: 65537\nBinary: 10000000000000001\nOctal: 200001\nHex: 10001\nHex (uppercase): 10001\n\nBinary (alternate): 0b10000000000000001\nOctal (alternate): 0o200001\nHex (alternate): 0x10001\nHex (uppercase, alternate): 0X10001\n\nBinary, underscore seperator: 1_0000_0000_0000_0001\nOctal, underscore seperator: 20_0001\nHex, underscore seperator: 1_0001\nHex, uppercase, underscore seperator: 1_0001\n\nExample: hex with prefix and padding: 0x00010001\n"
}
],
"source": [
......@@ -364,7 +364,9 @@
"print(f'Binary, underscore seperator: {value:_b}')\n",
"print(f'Octal, underscore seperator: {value:_o}')\n",
"print(f'Hex, underscore seperator: {value:_x}')\n",
"print(f'Hex, uppercase, underscore seperator: {value:_X}')"
"print(f'Hex, uppercase, underscore seperator: {value:_X}')\n",
"print()\n",
"print(f'Example: hex with prefix and padding: 0x{value:=08x}')"
]
},
{
......@@ -378,7 +380,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 18,
"metadata": {},
"outputs": [
{
......@@ -415,7 +417,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 1,
"metadata": {},
"outputs": [
{
......@@ -447,7 +449,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 2,
"metadata": {},
"outputs": [
{
......@@ -479,7 +481,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 3,
"metadata": {},
"outputs": [
{
......@@ -520,13 +522,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Reverse date, good for sorted filenames: 2020-01-30 at 15-52-44\nTime including milliseconds: 15:52:44.256\n\nWeekday as locale’s abbreviated name: Thu\nWeekday as locale’s full %X: Thursday\nWeekday as a decimal number, where 0 is Sunday and 6 is Saturday: 4\nDay of the month as a zero-padded decimal number: 30\nMonth as locale’s abbreviated name.: Jan\nMonth as locale’s full name: January\nMonth as a zero-padded decimal number: 01\nYear without century as a zero-padded decimal number: 20\nYear with century as a decimal number: 2020\nHour (24-hour clock) as a zero-padded decimal number: 15\nHour (12-hour clock) as a zero-padded decimal number: 03\nLocale’s equivalent of either AM or PM: PM\nMinute as a zero-padded decimal number: 52\nSecond as a zero-padded decimal number: 44\nMicrosecond as a decimal number, zero-padded on the left: 256674\nUTC offset in the form +HHMM or -HHMM #1: \nTime zone name (empty string if the object is naive): \nDay of the year as a zero-padded decimal number: 030\nWeek number of the year #2: 04\nWeek number of the year #3: 04\nLocale’s appropriate date and time representation: Thu Jan 30 15:52:44 2020\nLocale’s appropriate date representation: 01/30/20\nLocale’s appropriate time representation: 15:52:44\n\n"
"text": "Reverse date, good for sorted filenames: 2020-01-30 at 17-31-35\nTime including milliseconds: 17:31:35.884\n\nWeekday as locale’s abbreviated name: Thu\nWeekday as locale’s full %X: Thursday\nWeekday as a decimal number, where 0 is Sunday and 6 is Saturday: 4\nDay of the month as a zero-padded decimal number: 30\nMonth as locale’s abbreviated name.: Jan\nMonth as locale’s full name: January\nMonth as a zero-padded decimal number: 01\nYear without century as a zero-padded decimal number: 20\nYear with century as a decimal number: 2020\nHour (24-hour clock) as a zero-padded decimal number: 17\nHour (12-hour clock) as a zero-padded decimal number: 05\nLocale’s equivalent of either AM or PM: PM\nMinute as a zero-padded decimal number: 31\nSecond as a zero-padded decimal number: 35\nMicrosecond as a decimal number, zero-padded on the left: 884137\nUTC offset in the form +HHMM or -HHMM #1: \nTime zone name (empty string if the object is naive): \nDay of the year as a zero-padded decimal number: 030\nWeek number of the year #2: 04\nWeek number of the year #3: 04\nLocale’s appropriate date and time representation: Thu Jan 30 17:31:35 2020\nLocale’s appropriate date representation: 01/30/20\nLocale’s appropriate time representation: 17:31:35\n\n"
}
],
"source": [
......@@ -585,7 +587,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -609,6 +611,24 @@
"print(f'Output: {value:{fill}{align}{sign}{width}{grouping_option}{precision}{type}}')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": "'0x00000011'"
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f'0x{17:=08x}'"
]
},
{
"cell_type": "code",
"execution_count": null,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment