Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

When you call "load_workbook" it creates a new instance of the openpyxl workbook object. The variable is pointing to a location in memory where that object is stored.

When you have python to compare w1 to w2 it can only compare the reference to a memory location. The memory address can be seen in idle by just typing the variable name.

>>> wb1 = load_workbook('master.xlsx') >>> wb2 = load_workbook('master.xlsx') >>> wb1 == wb2 False >>> wb1 <openpyxl.workbook.workbook.Workbook object at 0x03ED3B50> >>> wb2 <openpyxl.workbook.workbook.Workbook object at 0x04AD7E30> 

If you want to verify that one workbook is the same as another you would need to write your own code that looks deeper into each object. One way to do this would be to use a hash. (See: http://stackoverflow.com/a/16876405/2535649https://stackoverflow.com/a/16876405/2535649)

When you call "load_workbook" it creates a new instance of the openpyxl workbook object. The variable is pointing to a location in memory where that object is stored.

When you have python to compare w1 to w2 it can only compare the reference to a memory location. The memory address can be seen in idle by just typing the variable name.

>>> wb1 = load_workbook('master.xlsx') >>> wb2 = load_workbook('master.xlsx') >>> wb1 == wb2 False >>> wb1 <openpyxl.workbook.workbook.Workbook object at 0x03ED3B50> >>> wb2 <openpyxl.workbook.workbook.Workbook object at 0x04AD7E30> 

If you want to verify that one workbook is the same as another you would need to write your own code that looks deeper into each object. One way to do this would be to use a hash. (See: http://stackoverflow.com/a/16876405/2535649)

When you call "load_workbook" it creates a new instance of the openpyxl workbook object. The variable is pointing to a location in memory where that object is stored.

When you have python to compare w1 to w2 it can only compare the reference to a memory location. The memory address can be seen in idle by just typing the variable name.

>>> wb1 = load_workbook('master.xlsx') >>> wb2 = load_workbook('master.xlsx') >>> wb1 == wb2 False >>> wb1 <openpyxl.workbook.workbook.Workbook object at 0x03ED3B50> >>> wb2 <openpyxl.workbook.workbook.Workbook object at 0x04AD7E30> 

If you want to verify that one workbook is the same as another you would need to write your own code that looks deeper into each object. One way to do this would be to use a hash. (See: https://stackoverflow.com/a/16876405/2535649)

Source Link
John Steel
  • 324
  • 1
  • 8

When you call "load_workbook" it creates a new instance of the openpyxl workbook object. The variable is pointing to a location in memory where that object is stored.

When you have python to compare w1 to w2 it can only compare the reference to a memory location. The memory address can be seen in idle by just typing the variable name.

>>> wb1 = load_workbook('master.xlsx') >>> wb2 = load_workbook('master.xlsx') >>> wb1 == wb2 False >>> wb1 <openpyxl.workbook.workbook.Workbook object at 0x03ED3B50> >>> wb2 <openpyxl.workbook.workbook.Workbook object at 0x04AD7E30> 

If you want to verify that one workbook is the same as another you would need to write your own code that looks deeper into each object. One way to do this would be to use a hash. (See: http://stackoverflow.com/a/16876405/2535649)