Re: question on the 'calendar' function
Sorry, but, that is largely what programming is. On Wed, Nov 21, 2018 at 4:09 PM o1bigtenor wrote: > On Wed, Nov 21, 2018 at 2:47 PM Calvin Spealman > wrote: > > > > Python and the standard library are all tools, but you still need to use > those tools to accomplish something. > > > > This is am understanding. > What I'm doing is making tools to make tools to make tools to make > tools to make decisions > and I'm finding that a very large amount of my time is spent making tools. > Wanted to curtail that time amount but not having much luck! > > Regards > -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Wed, Nov 21, 2018 at 2:47 PM Calvin Spealman wrote: > > Python and the standard library are all tools, but you still need to use > those tools to accomplish something. > This is am understanding. What I'm doing is making tools to make tools to make tools to make tools to make decisions and I'm finding that a very large amount of my time is spent making tools. Wanted to curtail that time amount but not having much luck! Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
Python and the standard library are all tools, but you still need to *use* those tools to accomplish something. On Wed, Nov 21, 2018 at 12:01 PM o1bigtenor wrote: > On Wed, Nov 21, 2018 at 8:09 AM Calvin Spealman > wrote: > > > > You really have the pieces you need here. You can print a whole year's > calendar with calendar.formatyear() or a single month with > calendar.monthcalendar(). If you need multiple years, call the first more > than once with each year you need to print. If you need partial years, > print the individual months you need with monthcalendar() > > > > Can you actually be more specific on what about the task is stumping you? > > OK so there needs to be a 2 level request, as I'm thinking of it, > rather than being able to > write something like (using human speak): > > print 36 months starting from 2017.06 or > print 60 months starting from 2017.03 with possible formatting > instructions. > > There seem to be a severe limit in the function in that a year is a > maximum single > time frame. I need to function within a time range of 2 to 3 or 4 > years. That means > that I move between the week/month and the longer frame lots and most > software > seems to be hard limited to a single year as the limit on the macro scale. > > Oh well - - - - guess I can't do what I want then - - - thanks for the > assistance. > > Regards > -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On 21/11/2018 12:27, o1bigtenor wrote: [Stuff clipped] What I need is to be able to have more than one calendar year options and this function seems to be limited to work with a maximum of only one year at a time. If I not reading the documentation correctly - - - please advise. (Thanking you for your generous assistance in the foregoing!) Regards You need to write a program (in Python) to do that using the methods in the calendar module. HINT: print out the calendar for each month you are interested in and use a loop of some kind to generate the year/month data to feed to calendar methods from a starting and stopping date. There will be many other ways of doing this but a solution that works, even if ugly, is better than no solution. -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Wed, Nov 21, 2018 at 8:09 AM Calvin Spealman wrote: > > You really have the pieces you need here. You can print a whole year's > calendar with calendar.formatyear() or a single month with > calendar.monthcalendar(). If you need multiple years, call the first more > than once with each year you need to print. If you need partial years, print > the individual months you need with monthcalendar() > > Can you actually be more specific on what about the task is stumping you? OK so there needs to be a 2 level request, as I'm thinking of it, rather than being able to write something like (using human speak): print 36 months starting from 2017.06 or print 60 months starting from 2017.03 with possible formatting instructions. There seem to be a severe limit in the function in that a year is a maximum single time frame. I need to function within a time range of 2 to 3 or 4 years. That means that I move between the week/month and the longer frame lots and most software seems to be hard limited to a single year as the limit on the macro scale. Oh well - - - - guess I can't do what I want then - - - thanks for the assistance. Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
You really have the pieces you need here. You can print a whole year's calendar with calendar.formatyear() or a single month with calendar.monthcalendar(). If you need multiple years, call the first more than once with each year you need to print. If you need partial years, print the individual months you need with monthcalendar() Can you actually be more specific on what about the task is stumping you? On Wed, Nov 21, 2018 at 7:28 AM o1bigtenor wrote: > On Wed, Nov 21, 2018 at 2:37 AM wrote: > > > > On Tuesday, November 20, 2018 at 7:53:06 PM UTC+1, o1bigtenor wrote: > > > On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph > > > wrote: > > > > > > > > It's possible I don't understand the question. The calendar > functions are NOT limited to this year or any limited range. > > > > > > > > Example: > > > > import calendar > > > > print( calendar.monthcalendar(2022, 12) ) > > > > > > > > Prints lists of dates in each week of December 2022. It prints: > > > > [[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, > 16, 17, 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]] > > > > > > > > So, Dec 1 is a Wednesday; Dec 31 is a Saturday. > > > > > > > > That's 49 months ahead of this month. Change the year and month to > any (valid) number, and it will do what it does. > > > > The only caveat is that if the moon's orbit slows down as it gets > farther away from the earth and the earth's rotation speed changes, then > the calculations done by calendar for leap years may not be correct about > the distant future. > > > > > > > > > > Greetings > > > > > > If my syntax or commands are wrong - - - - I've just started so > > > something is likely to NOT be correct - - - grin - - - I'sa noob! > > > > > > # calendar 2019 > > > > > > that is to show the year 2019 > > > > > > How could I show June 2018 to Dec 2019, inclusive? > > > Or June 2018 to Dec 2021, inclusive? > > > Or June 2018 to Dec 2023 by week (June wk 1,2,3,4 2018; July wk > > > 1,2,3,4,5 2018; . . . Dec wk 1,2,3,4,5 2023 or maybe even by dates), > > > inclusive? > > > > > > Note that the time frame is ALWAYS more than 1 year. > > > AIUI there isn't a way to do that, at least not that I can see, and I > > > would like to be able to do that. > > > A friend suggested using a script wrapped around the command. I > > > thought maybe there might we a way of doing what I need to do without > > > using 2 levels of programming. > > > > > > Regards > > > > From what you post it seems like you are on a Linux kind of system and > you are running the `calendar` command in the bash terminal. If that is > correct, try the following: > > > > In the bash terminal type (without the literal #): > > # python > > > > This will put you in the Python prompt (marked with >>>). > > Check that the first line starts with Python 3. If not, I highly > recommend > > you install Python 3. If it is Python two, the following will work, but > you > > have to drop the outer parentheses for print (thus print > calendar.calendar()) > > > > Then type the following: > > >>> import calendar > > >>> print(calendar.calendar(2020)) > > > Now look at the documentation of the calendar module to find out about > > other options. > > > > Thank you very much Mr Marco - - - that got me to being able to do > something > (will need time to figure out how to do the rest! grin!!). > I have read through the documentation and there really doesn't seem to be > a way > to do what I would like to do - - - - in this case. > > What I can't do is (following your directions) > > >>> import calendar > >>> print(calendar.calendar(Mar 2018 to Dec 2023)) > > What I need is to be able to have more than one calendar year options and > this > function seems to be limited to work with a maximum of only one year at a > time. > > If I not reading the documentation correctly - - - please advise. > (Thanking you for your generous assistance in the foregoing!) > > Regards > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Wed, Nov 21, 2018 at 2:37 AM wrote: > > On Tuesday, November 20, 2018 at 7:53:06 PM UTC+1, o1bigtenor wrote: > > On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph > > wrote: > > > > > > It's possible I don't understand the question. The calendar functions > > > are NOT limited to this year or any limited range. > > > > > > Example: > > > import calendar > > > print( calendar.monthcalendar(2022, 12) ) > > > > > > Prints lists of dates in each week of December 2022. It prints: > > > [[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, > > > 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]] > > > > > > So, Dec 1 is a Wednesday; Dec 31 is a Saturday. > > > > > > That's 49 months ahead of this month. Change the year and month to any > > > (valid) number, and it will do what it does. > > > The only caveat is that if the moon's orbit slows down as it gets farther > > > away from the earth and the earth's rotation speed changes, then the > > > calculations done by calendar for leap years may not be correct about the > > > distant future. > > > > > > > Greetings > > > > If my syntax or commands are wrong - - - - I've just started so > > something is likely to NOT be correct - - - grin - - - I'sa noob! > > > > # calendar 2019 > > > > that is to show the year 2019 > > > > How could I show June 2018 to Dec 2019, inclusive? > > Or June 2018 to Dec 2021, inclusive? > > Or June 2018 to Dec 2023 by week (June wk 1,2,3,4 2018; July wk > > 1,2,3,4,5 2018; . . . Dec wk 1,2,3,4,5 2023 or maybe even by dates), > > inclusive? > > > > Note that the time frame is ALWAYS more than 1 year. > > AIUI there isn't a way to do that, at least not that I can see, and I > > would like to be able to do that. > > A friend suggested using a script wrapped around the command. I > > thought maybe there might we a way of doing what I need to do without > > using 2 levels of programming. > > > > Regards > > From what you post it seems like you are on a Linux kind of system and you > are running the `calendar` command in the bash terminal. If that is correct, > try the following: > > In the bash terminal type (without the literal #): > # python > > This will put you in the Python prompt (marked with >>>). > Check that the first line starts with Python 3. If not, I highly recommend > you install Python 3. If it is Python two, the following will work, but you > have to drop the outer parentheses for print (thus print calendar.calendar()) > > Then type the following: > >>> import calendar > >>> print(calendar.calendar(2020)) > Now look at the documentation of the calendar module to find out about > other options. > Thank you very much Mr Marco - - - that got me to being able to do something (will need time to figure out how to do the rest! grin!!). I have read through the documentation and there really doesn't seem to be a way to do what I would like to do - - - - in this case. What I can't do is (following your directions) >>> import calendar >>> print(calendar.calendar(Mar 2018 to Dec 2023)) What I need is to be able to have more than one calendar year options and this function seems to be limited to work with a maximum of only one year at a time. If I not reading the documentation correctly - - - please advise. (Thanking you for your generous assistance in the foregoing!) Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Tuesday, November 20, 2018 at 7:53:06 PM UTC+1, o1bigtenor wrote: > On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph > wrote: > > > > It's possible I don't understand the question. The calendar functions are > > NOT limited to this year or any limited range. > > > > Example: > > import calendar > > print( calendar.monthcalendar(2022, 12) ) > > > > Prints lists of dates in each week of December 2022. It prints: > > [[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, > > 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]] > > > > So, Dec 1 is a Wednesday; Dec 31 is a Saturday. > > > > That's 49 months ahead of this month. Change the year and month to any > > (valid) number, and it will do what it does. > > The only caveat is that if the moon's orbit slows down as it gets farther > > away from the earth and the earth's rotation speed changes, then the > > calculations done by calendar for leap years may not be correct about the > > distant future. > > > > Greetings > > If my syntax or commands are wrong - - - - I've just started so > something is likely to NOT be correct - - - grin - - - I'sa noob! > > # calendar 2019 > > that is to show the year 2019 > > How could I show June 2018 to Dec 2019, inclusive? > Or June 2018 to Dec 2021, inclusive? > Or June 2018 to Dec 2023 by week (June wk 1,2,3,4 2018; July wk > 1,2,3,4,5 2018; . . . Dec wk 1,2,3,4,5 2023 or maybe even by dates), > inclusive? > > Note that the time frame is ALWAYS more than 1 year. > AIUI there isn't a way to do that, at least not that I can see, and I > would like to be able to do that. > A friend suggested using a script wrapped around the command. I > thought maybe there might we a way of doing what I need to do without > using 2 levels of programming. > > Regards >From what you post it seems like you are on a Linux kind of system and you are >running the `calendar` command in the bash terminal. If that is correct, try >the following: In the bash terminal type (without the literal #): # python This will put you in the Python prompt (marked with >>>). Check that the first line starts with Python 3. If not, I highly recommend you install Python 3. If it is Python two, the following will work, but you have to drop the outer parentheses for print (thus print calendar.calendar()) Then type the following: >>> import calendar >>> print(calendar.calendar(2020)) This will show: 2020 January February March Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 1 6 7 8 9 10 11 12 3 4 5 6 7 8 9 2 3 4 5 6 7 8 13 14 15 16 17 18 19 10 11 12 13 14 15 16 9 10 11 12 13 14 15 20 21 22 23 24 25 26 17 18 19 20 21 22 23 16 17 18 19 20 21 22 27 28 29 30 3124 25 26 27 28 29 23 24 25 26 27 28 29 30 31 April May June Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14 13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30 July August September Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 5 1 2 1 2 3 4 5 6 6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13 13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20 20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27 27 28 29 30 3124 25 26 27 28 29 30 28 29 30 31 October November December Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su 1 2 3 4 1 1 2 3 4 5 6 5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13 12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20 19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31 30 Now look at the documentation of the calendar module to find out about other options. Marco -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
o1bigtenor writes: > On Tue, Nov 20, 2018 at 12:09 PM Ben Finney > wrote: > > o1bigtenor writes: > > > It could be useful to see the longer time spans as weeks rather > > > than as days but seeing the larger time frames only as months > > > would enable the planning that I need to do. > > > > Does ‘calendar.monthcalendar’ come close to what you need > > https://docs.python.org/3/library/calendar.html#calendar.monthcalendar>? > > No - - - the limit is still one year (of 12 months) and my minimum > would be 18 months and preferably quite a bit more. That doesn't match what I understand from the module documentation. Can you show a (small, self-contained) example that demonstrates the “limit is still one year” when you try to use ‘calendar.monthcalendar’ for the purpose you described above? -- \ “I have yet to see any problem, however complicated, which, | `\ when you looked at it in the right way, did not become still | _o__)more complicated.” —Paul Anderson | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Tue, Nov 20, 2018 at 12:09 PM Ben Finney wrote: > > o1bigtenor writes: > > > I am in the process of learning my first computer programming language > > (unless g-code counts and then it is my second - - - grin). It > > definitely is a big world out there. > > Welcome, and congratulations on starting with Python! > > > The calendar function has a lot of versatility and shows care in its > > development. > > I assume we are here talking about the standard library ‘calendar’ > module https://docs.python.org/3/library/calendar.html>, and the > function is ‘calendar.calendar’ to generate a whole year calendar > https://docs.python.org/3/library/calendar.html#calendar.calendar>. These are the documents that I was examining before I asked my question. > > > For planning I need to be able to easily look backward 6 months and > > forward at least 12 and better 18 months and would prefer perhaps even > > a total of 36 (and even 60 might be useful) months of calendar > > available. It could be useful to see the longer time spans as weeks > > rather than as days but seeing the larger time frames only as months > > would enable the planning that I need to do. > > Have you looked through the rest of the documentation of that module? > Does ‘calendar.monthcalendar’ come close to what you need > https://docs.python.org/3/library/calendar.html#calendar.monthcalendar>? No - - - the limit is still one year (of 12 months) and my minimum would be 18 months and preferably quite a bit more. > > > Do I need to (somehow and I have no idea how) extend the calendar > > function? > > It's quite feasible you may get to that point, at which time you will > want to learn about composing functions by calling other functions; > eventually you will learn a different technique, of creating a class by > inheriting from an existing class. Hmm - - - this sounds like what I'm going to have to do. let's see if I can find docs on this. > > But all that may be in the future! Try just using the existing functions > from that library module and see how far that gets you. The calendar function as it exists just quite spread its wings far enough for my needs but this extension by inheritance is intriguing! Thanks for the ideas. -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
On Tue, Nov 20, 2018 at 11:50 AM Schachner, Joseph wrote: > > It's possible I don't understand the question. The calendar functions are > NOT limited to this year or any limited range. > > Example: > import calendar > print( calendar.monthcalendar(2022, 12) ) > > Prints lists of dates in each week of December 2022. It prints: > [[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, > 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]] > > So, Dec 1 is a Wednesday; Dec 31 is a Saturday. > > That's 49 months ahead of this month. Change the year and month to any > (valid) number, and it will do what it does. > The only caveat is that if the moon's orbit slows down as it gets farther > away from the earth and the earth's rotation speed changes, then the > calculations done by calendar for leap years may not be correct about the > distant future. > Greetings If my syntax or commands are wrong - - - - I've just started so something is likely to NOT be correct - - - grin - - - I'sa noob! # calendar 2019 that is to show the year 2019 How could I show June 2018 to Dec 2019, inclusive? Or June 2018 to Dec 2021, inclusive? Or June 2018 to Dec 2023 by week (June wk 1,2,3,4 2018; July wk 1,2,3,4,5 2018; . . . Dec wk 1,2,3,4,5 2023 or maybe even by dates), inclusive? Note that the time frame is ALWAYS more than 1 year. AIUI there isn't a way to do that, at least not that I can see, and I would like to be able to do that. A friend suggested using a script wrapped around the command. I thought maybe there might we a way of doing what I need to do without using 2 levels of programming. Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: question on the 'calendar' function
o1bigtenor writes: > I am in the process of learning my first computer programming language > (unless g-code counts and then it is my second - - - grin). It > definitely is a big world out there. Welcome, and congratulations on starting with Python! > The calendar function has a lot of versatility and shows care in its > development. I assume we are here talking about the standard library ‘calendar’ module https://docs.python.org/3/library/calendar.html>, and the function is ‘calendar.calendar’ to generate a whole year calendar https://docs.python.org/3/library/calendar.html#calendar.calendar>. > For planning I need to be able to easily look backward 6 months and > forward at least 12 and better 18 months and would prefer perhaps even > a total of 36 (and even 60 might be useful) months of calendar > available. It could be useful to see the longer time spans as weeks > rather than as days but seeing the larger time frames only as months > would enable the planning that I need to do. Have you looked through the rest of the documentation of that module? Does ‘calendar.monthcalendar’ come close to what you need https://docs.python.org/3/library/calendar.html#calendar.monthcalendar>? > Do I need to (somehow and I have no idea how) extend the calendar > function? It's quite feasible you may get to that point, at which time you will want to learn about composing functions by calling other functions; eventually you will learn a different technique, of creating a class by inheriting from an existing class. But all that may be in the future! Try just using the existing functions from that library module and see how far that gets you. Good hunting. -- \ “I have the simplest tastes. I am always satisfied with the | `\best.” —Oscar Wilde, quoted in _Chicago Brothers of the Book_, | _o__) 1917 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
RE: question on the 'calendar' function
It's possible I don't understand the question. The calendar functions are NOT limited to this year or any limited range. Example: import calendar print( calendar.monthcalendar(2022, 12) ) Prints lists of dates in each week of December 2022. It prints: [[0, 0, 0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11], [12, 13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24, 25], [26, 27, 28, 29, 30, 31, 0]] So, Dec 1 is a Wednesday; Dec 31 is a Saturday. That's 49 months ahead of this month. Change the year and month to any (valid) number, and it will do what it does. The only caveat is that if the moon's orbit slows down as it gets farther away from the earth and the earth's rotation speed changes, then the calculations done by calendar for leap years may not be correct about the distant future. --- Joseph S. -Original Message- From: o1bigtenor Sent: Tuesday, November 20, 2018 8:37 AM To: python-list@python.org Subject: question on the 'calendar' function Greetings I am in the process of learning my first computer programming language (unless g-code counts and then it is my second - - - grin). It definitely is a big world out there. The calendar function has a lot of versatility and shows care in its development. There is one area where I don't understand if I even could use this function or if I need to look to something(s) else to achieve what I need. For planning I need to be able to easily look backward 6 months and forward at least 12 and better 18 months and would prefer perhaps even a total of 36 (and even 60 might be useful) months of calendar available. It could be useful to see the longer time spans as weeks rather than as days but seeing the larger time frames only as months would enable the planning that I need to do. Do I need to (somehow and I have no idea how) extend the calendar function? Is there some other way of displaying dates/calendars that would allow me to achieve my needed span? TIA -- https://mail.python.org/mailman/listinfo/python-list